Usenet comp.unix.osf.osf1 (1992-2004)
 help / color / mirror / Atom feed
From: Aurel Balmosan <ab@orga.com>
Subject: Multi writes and multi reads on a local TCP socket.
Date: 1999/05/20	[thread overview]
Message-ID: <37441C09.A3AD400C@orga.com> (raw)

Hi all,

I noticed a problem when I use two writes() to write first a header
containing the length of the message which I write after that.

The read() which reads the header finishes immediately. The read which I
use to get the actual data waits about constant 200ms before it
finished. In the example I sent 116 bytes as message.

Between the two reads I use a select with a timeout value before calling
the second read(). This select() needs also about 200ms before it says
that data are available. The read() then returns immediately. When I
don't use the select the same time of 200ms can be noticed directly in
the read() call.

The effect is constant on different DEC-Unix 4.0[abd] machines. One was
a low end dec alpha the other a high end dec alpha 4 times faster. Both
show exactly the 200ms delay.

When I use writev the 200ms delay is not there. Actually the delay is
below 100us with and without select() in between of the two reads.

Well I found out that the socket option TCP_NODELAY helps here. With
this option there is no delay even with two separat writes(). I wonder
why Digitial thought that after a second write() a third write() might
happen.


Bye,

    Aurel Balmosan.
I




                 reply	other threads:[~1999-05-20  4:00 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed
read-only archive

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox