> i used wireshark to monitor activity on the port i m listening on.Protocol
> is TCP and the server was build with ICS TWSocketServer.

> Monitoring packages arrived, I see that one of the packages (505 byte) is
> divided into 3 packages.

> What i want to ask; is this the way tcp protocol transfers data over
> network,
> or package count is because of the method client uses to send data..?

Depends. Packet size is typically limited to ~1500 bytes, can go up to
few kilobytes if jumbo frames are enabled. Regardless, depending of
through what your data have come, they can be split into smaller packets
(that's called packet fragmentation). Also, if sending side disables
Nagle algorhitm (sets tcpNoDelay flag), data are sent immediately - one
packet per one "send" call. If that flag is not set, data are sent only
after filling up a packet or after a few miliseconds of pause between

> Can we make a package transfered in a whole (in size limitations) or tcp
> decides how to transfer data by itself?

Between sending and receiving side there may be a router or bridge
that can't handle certain packet sizes. At this point your packets might
be split into two or more. 

> The reason i am in this case is not the package count, but the headers used
> to form a package which makes data count increase..

See above. Either don't disable Nagle algorithm or send in large chunks.
As receiving side, you can't do anything to reduce packet count.

(as a side note, in client-server request-response scenarios, packet
count can be dramatically reduced by utilizing "pipelining", that is -
sending all requests in one go and then waiting for responses instead of
sending single request, waiting for response, sending another request, ...
and so on; for POP3/NNTP protocol you usually can fit all your RETR/ARTICLE
requests in just one outgoing packet).   

Piotr Dałek

Praca za granicą? Zobacz oferty!

To unsubscribe or change your settings for TWSocket mailing list
please goto http://lists.elists.org/cgi-bin/mailman/listinfo/twsocket
Visit our website at http://www.overbyte.be

Reply via email to