02-11-2010 04:43 PM
I too am having TCP/IP problems with packet sizes.
I'm reading from a file then calling ClientTCPWrite() to write the data I just read from the file to my server, reading from a file, calling ClientTCPWrite(), and so on, and so on.
Instead of my server receiving a packet everytime I do a ClientTCPWrite() something (LabWindows?) is bunching a bunch of them together and sending big packets (4380 bytes of data). My ClientTCPWrite() data size is usually less than 100 bytes.
Even if I call ClientTCPWrite() with a data size of around 4K (like 4032) my server is still receiving packets that are bigger than the ClientTCPWrite() data size.
If I call ClientTCPWrite() with a data size of around 8K my server is still receiving packets around the 4380 byte size.
It seems as though this could be caused by the Nagle algorithm?
I tried to use the responses here to turn off the Nagle algorithm.
I got the GetHostTCPSocketHandle) call to work but when I tried to use setsockopt() I get undeclared identifiers for IPROTO_TCP and TCP_NODELAY and a missing prototype for setsockopt(). I can find the prototype for setsockopt() and the define for TCP_NODELAY in winsock.h but when I try to include it I get all sorts of redeclaration and redefinition errors. I can't find the define for IPROTO_TCP anywhere.
I'm using LabWindows/CVI version 7.1.0 (306) (WinNT/2000/XP) on a PC with Windows XP Professional, version 5.1, service pack 3.
Can you help me gain more control over my TCP/IP packet size?
Thank you!
Gwen