(E-Mail Removed) wrote:
> Hi all,
>
> I noticed that when I use send() function to send data to remote PC,
> I
> see all the data on same packet (Wireshark) even though I used send
> more than once.
> For example,
>
> send("er");
> send("an");
> send("ya");
>
> I will see the data on same packet rether than 3 packets.
If you're using a stream socket (TCP), it is
perfectly normal.
TCP guarantees only that all octets (bytes) sent
eventually arrive at the destination in the same
order as they are sent.
There's no guarantee whatsoever of correspondence
of the socket write lengths and the lengths of the
packets on wire.
If you want to preserve record boundaries, you have
two options:
- Embed the record boundary markers or record
lengths into the TCP data stream, or
- use UDP (and be prepared for missing and/or mis-
ordered packets).
--
Tauno Voipio