Re: Portable way to close() and prevent RST with non-empty receive queue?

From: Andrei Voropaev (avorop_at_mail.ru)
Date: 11/21/05


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


Relevant Pages

  • Re: Portable way to close() and prevent RST with non-empty receive queue?
    ... >> I'm implementing a HTTP monitoring server that responds to all requests ... On Linux 2.6.14 without the shutdown, the client gets a RST ... RST is sent by the kernel when it receives data for the socket ...
    (comp.unix.programmer)
  • COM Interop + Threading + Scalability
    ... The Client completely denies ... The Rules Processor is implemented in VB 6 and the ASP.NET ... multiple concurrent requests for the Rules Processor. ... creates and initializes an apartment when calling a COM ...
    (microsoft.public.dotnet.framework.interop)
  • Re: [CFT][PATCH] new scheduler policy
    ... "The X server uses selectto detect clients with pending input. ... executing requests from the client with the smallest file descriptor. ... Each client has a buffer which is used to read some data from the ...
    (Linux-Kernel)
  • RE: Citrix/ISA
    ... Microsoft CSS Online Newsgroup Support ... |> server" will not affect your Web proxy functionality. ... |> requests from firewall client and SecureNAT client will not be able to ... |> HTTP redirector filter is used to grab the HTTP/HTTPS/FTP requests from ...
    (microsoft.public.windows.server.sbs)
  • RE: Citrix/ISA
    ... changing HTTP redirector filter to "Send to requested Web ... requests from firewall client and SecureNAT client will not be able to ... HTTP redirector filter is used to grab the HTTP/HTTPS/FTP requests from ... Redirect requests from Firewall and SecureNAT clients to the Web Proxy ...
    (microsoft.public.windows.server.sbs)

Loading