From mboxrd@z Thu Jan 1 00:00:00 1970 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: fee84,bdffaee2f23a6a35,start X-Google-Attributes: gidfee84,public From: Aurel Balmosan Subject: Multi writes and multi reads on a local TCP socket. Date: 1999/05/20 Message-ID: <37441C09.A3AD400C@orga.com>#1/1 X-Deja-AN: 480150834 X-Nntp-Posting-Host: 194.122.136.143 Content-Transfer-Encoding: 7bit Sender: news@orga.com (News Administrator) Organization: ORGA Kartensysteme GmbH Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 Newsgroups: comp.unix.osf.osf1 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