Newsgroups : Borland : borland.public.delphi.internet.winsock : 2006 Oct : Re: Assured Minimum Size
| Subject: | Re: Assured Minimum Size |
| Posted by: | "Martin James" (nospam@dial.pipex.com) |
| Date: | Wed, 4 Oct 2006 17:25:53 |
Allan Fernandes wrote:
> Hi,
>
> I am using Delphi 5 with TServerSocket and TClientSocket. I use
> socket.sendtext() to send small text messages successfully. When I have to
> send larger text messages I am not sure that it reaches the destination in
> one packet. Is there any minimum packet size that I can be sure will be
> received at the destination in a single Read event.
>
Yes - one byte <g>
Sorry, but that's just about it. TCP transfers 'octet streams'. If you
want to send structured messages with TCP, rather than a stream of
bytes, you have to add a protocol on top to 'block up' the bytes into
your application protocol-unit.
Any other approach, eg. sending very small messages and hoping that they
will always be received in one read, will screw up, sooner or later.
'Messages' will get split and/or concatenated, at the will of the network.
Rgds,
Martin
none