* Multi writes and multi reads on a local TCP socket.
@ 1999-05-20 4:00 Aurel Balmosan
0 siblings, 0 replies; only message in thread
From: Aurel Balmosan @ 1999-05-20 4:00 UTC (permalink / 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
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~1999-05-20 4:00 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
1999-05-20 4:00 Multi writes and multi reads on a local TCP socket Aurel Balmosan
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox