View Full Version : TCP limitations?

29-11-2009, 07:50 AM
I've been doing testing with WSockets component lately and its giving weird results. I did a very simple program for file transfer that when connection lasts throughout transfer, always sends the file perfectly without file errors. Problem is that if i increase packet size from 1k bytes to 2k or more it will cause client connection to end with error message.

Within my country i tested with someone else with 4k packets and it sometimes worked, sometimes didn't. On local testing within my computer the 4k worked perfectly giving a 10Mb/s transfer rate. (this can be handy for app<->app communication)
Then a test with someone outside my country only worked with 1k... even 2k gave errors right away.

Component seem to use blocking packets (not allow sending only part of packet). Also when sending a packet i always send a small about 11 bytes answer after which another data part is sent.

Any ideas, or know of component that you have tested to work better?

File with full source here:

20-12-2009, 05:47 PM
TCP is a streaming protocol, reliable, in order delivery. I've not come across such an issue before but I do know that with UDP a large MTU (http://en.wikipedia.org/wiki/Maximum_transmission_unit) can cause a lot of packets to drop.

21-12-2009, 12:02 AM
Just opened the link you gave and...
"For example, a 1500 byte packet, the largest allowed by Ethernet at the network layer (and hence most of the Internet)"
... ehhh? I know for testing that 1500 or less is working about perfectly, is this why i'm having so much trouble?

Last tests i had now weeks ago had issues when i was downloading something same time. The whole thing seemed like a mess that i couldn't understand. WSockets itself i went through carefully and it is simple enough to know where things are going and what it does.

20-05-2010, 08:15 PM
What's the error code that send() is returning when the send fails?

21-05-2010, 05:56 AM
Send() didn't give any error if i recall, but this is now old topic because i no longer use this component or Delphi :) Synapse is a newer lib for using sockets and works with Lazarus.