Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

socket

0 views
Skip to first unread message

Andrew Gierth

unread,
Oct 29, 1997, 3:00:00 AM10/29/97
to

>>>>> "Claus" == Claus Rödenbeck <roe...@itp.uni-hannover.de> writes:

Claus> Hi!
Claus> If I connect to another host, I create a socket. If I write
Claus> n bytes to this socket one question arises:

Claus> * Will the operating system send this block of data
Claus> imedeately to the other host or will it wait for
Claus> another m bytes until an internal buffer is filled ?

Unless you have explicitly requested otherwise (e.g. on systems that
support the TCP_NOPUSH option), then all writes to a socket are
'pushed', that is, the data will be sent to the other host as soon as
the protocol allows. (It may be delayed by the Nagle algorithm,
slow-start, retransmit backoffs, insufficient space in the window,
etc., but these are all necessary parts of the protocol.)

This is why it's important for applications to avoid issuing many
small write() calls.

--
Andrew.

comp.unix.programmer FAQ: see <URL: http://www.erlenstar.demon.co.uk/unix/>
or <URL: http://www.whitefang.com/unix/>

Rainer Temme

unread,
Oct 29, 1997, 3:00:00 AM10/29/97
to


Claus Rödenbeck wrote:...


> If I connect to another host, I create a socket. If I write

> n bytes to this socket one question arises:
>

> * Will the operating system send this block of data

> imedeately to the other host or will it wait for

> another m bytes until an internal buffer is filled ?
>

> If so, how can I change the size of this buffer ?
>
> Thanks in advance,

A write() on a socket might be buffered for a (very short) time
to get data from the next write() into the same transport-paket.
If no write() is called for this short time (normally something
around 100ms) a paket (which is not completely filled) will be
sent.
Generally the data of your write() will not be buffered until
enough data for maximum paketsize is available.

Claus Rödenbeck

unread,
Oct 29, 1997, 3:00:00 AM10/29/97
to

Hi!

If I connect to another host, I create a socket. If I write
n bytes to this socket one question arises:

* Will the operating system send this block of data
imedeately to the other host or will it wait for
another m bytes until an internal buffer is filled ?

If so, how can I change the size of this buffer ?

Thanks in advance,

Claus


--
Claus Roedenbeck
Institut fuer Theoretische Physik, Appelstrasse 2
30167 Hannover, Tel. 0511/762-4836

roe...@itp.uni-hannover.de http://www.itp.uni-hannover.de/~roeden

0 new messages