Re: Portable way to close() and prevent RST with non-empty receive queue?
From: Andrei Voropaev (avorop_at_mail.ru)
Date: 11/21/05
- Next message: ramsailu_at_gmail.com: "Mutex Locks and semaphores"
- Previous message: Daniel C. Bastos: "Re: How to socket and utf-8?"
- In reply to: Thomas Kho: "Portable way to close() and prevent RST with non-empty receive queue?"
- Next in thread: Daniel C. Bastos: "Re: Portable way to close() and prevent RST with non-empty receive queue?"
- Reply: Daniel C. Bastos: "Re: Portable way to close() and prevent RST with non-empty receive queue?"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Mon, 21 Nov 2005 10:48:20 +0000 (UTC)
On 2005-11-17, Thomas Kho <thomaskho@gmail.com> wrote:
[...]
> Background:
> I'm implementing a HTTP monitoring server that responds to all requests
> with the same reply, and in the process doesn't bother to read the
> request. On Linux 2.6.14 without the shutdown(), the client gets a RST
> instead of the connection properly closing.
>
Nothing will help. If you close connection without reading the input
stream, and the client doesn't check for EOF(FIN) before trying to write
(or has put already lots of data in the out-buffer) then the client will
receive RST. Shutdown is really of no help here. That's just a way to
signal to remote side that you are done with writing and it may start
sending, or to signal kernel that you don't want to read from the socket
anymore. RST is sent by the kernel when it receives data for the socket
that doesn't do reading anymore or is closed. So, if you don't read, RST
will be sent when client attempts to send something.
-- Minds, like parachutes, function best when open
- Next message: ramsailu_at_gmail.com: "Mutex Locks and semaphores"
- Previous message: Daniel C. Bastos: "Re: How to socket and utf-8?"
- In reply to: Thomas Kho: "Portable way to close() and prevent RST with non-empty receive queue?"
- Next in thread: Daniel C. Bastos: "Re: Portable way to close() and prevent RST with non-empty receive queue?"
- Reply: Daniel C. Bastos: "Re: Portable way to close() and prevent RST with non-empty receive queue?"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|