Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.os.linux.development.apps > #387
| From | Kaz Kylheku <kaz@kylheku.com> |
|---|---|
| Newsgroups | comp.os.linux.development.apps |
| Subject | Re: EOF, close(), shutdown(), on POSIX sockets |
| Date | 2012-01-12 20:04 +0000 |
| Organization | A noiseless patient Spider |
| Message-ID | <20120112115830.10@kylheku.com> (permalink) |
| References | <ylfk62gpn3hg.fsf@dd-b.net> <1br4zdh37t.fsf@pfeifferfamily.net> <jen0gi$bc0$1@odin.sdf-eu.org> <1bfwfkr8w0.fsf@pfeifferfamily.net> |
On 2012-01-12, Joe Pfeiffer <pfeiffer@cs.nmsu.edu> wrote: > Andrei Voropaev <avorop@mail.ru> writes: >> Of course, many protocols allow sending of explicit notification to the peer >> when more data is not going to be accepted. But even in this case you >> should be ready to handle EPIPE error. > > You seem to be addressing the question of when the transmitter can know > the receiver has shut down. My experience has been that when the > *transmitter* has shut down, the receiver may wait an arbitrary amount > of time in a read() before finally returning a 0. Only because of network issues. When the transmitter has sealed that direction by shutting it down, it means that there is a queue of packets on the transmit side which has to drain. Only the last segment will carry the FIN flag indicating "I am the last". The network can be disrupted in the meanwhile. (Basically no byte that is sent by the transmitter will reach the receiver in a guaranteed time, and that includes the FIN flag.) On a fast, reliable network, you should not be seeing delays in read when the other side has shut down the connection. If the transmitting host crashes, or there is a long-term network outage or something else (e.g NAT mapping entry expiring, so you permanently lose the virtual circuit with no notification), that is different.
Back to comp.os.linux.development.apps | Previous | Next — Previous in thread | Find similar
EOF, close(), shutdown(), on POSIX sockets David Dyer-Bennet <dd-b@dd-b.net> - 2012-01-05 17:17 -0600
Re: EOF, close(), shutdown(), on POSIX sockets Kaz Kylheku <kaz@kylheku.com> - 2012-01-06 01:10 +0000
Re: EOF, close(), shutdown(), on POSIX sockets David Dyer-Bennet <dd-b@dd-b.net> - 2012-01-06 09:59 -0600
Re: EOF, close(), shutdown(), on POSIX sockets Joe Pfeiffer <pfeiffer@cs.nmsu.edu> - 2012-01-05 21:20 -0700
Re: EOF, close(), shutdown(), on POSIX sockets David Dyer-Bennet <dd-b@dd-b.net> - 2012-01-06 10:00 -0600
Re: EOF, close(), shutdown(), on POSIX sockets Andrei Voropaev <avorop@mail.ru> - 2012-01-12 16:07 +0000
Re: EOF, close(), shutdown(), on POSIX sockets Joe Pfeiffer <pfeiffer@cs.nmsu.edu> - 2012-01-12 12:57 -0700
Re: EOF, close(), shutdown(), on POSIX sockets Kaz Kylheku <kaz@kylheku.com> - 2012-01-12 20:04 +0000
csiph-web