Link to home
Start Free TrialLog in
Avatar of Hotbread
Hotbread

asked on

TCp/IP Nagle problem

I have an application that usues Tcp/Ip to communicate...the host sends very frequent time depenedant staus messages to the ckient.. like every 20 milliseconds...I cant slow them down... however i hit the nagle problem of the small packets being combined.. that screws up the timing aspect! How can i within Vb abdnd the winsock ocx, turn off nagling!!!!!



Avatar of fantasy1001
fantasy1001

As far as I know, you need to set SetSockOption API to WSQ_SOCK_OPTION.WSQ_TCP_NODELAY.
This must be done per every connection.
I had such problem and I had a workaround (not sure of any communcation settings, this is just a simple code).

At the end of every packet you send, send a unique character or two of yours -- some programs actually append Chr$(2) & Chr$(4) at the end.
On the other side, receive the packet and split it using the flag you created.

Assume you want to send "Hello" followed by "World!", and they were sent instantly that it became like this: "HelloWorld!". Using the flag, they will become "Hello24World!24" (I used the numbers 2 and 4 to represent Chr$(2) and Chr$(4)). At every occurance of the 24 flag, that is a packet.


My suggestion is very simple that I just noticed it's a 500-point question, I'm sure that wasn't what you were looking for, but I'm putting it for others who might find it helpful for related issues.
Avatar of Hotbread

ASKER

Thanks guys;... fraid I tried that DeuceEE BUT I need a packet every 20th of a sec to syncronise... so its not just the actual data BUT the time they arrive... fantasy... how can I do that with vanilla VB and using the winsock ocx control is it possible?
I am not sure of it. I used to have this problem long time ago with winsock also. One of our programming expert suggests that we use the api SetSockOption and set it to WSQ_SOCK_OPTION.WSQ_TCP_NODELAY. I donn't have pretty much info on it anyway.

ASKER CERTIFIED SOLUTION
Avatar of amp072397
amp072397

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial