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

From: Daniel C. Bastos (dbast0s_at_yahoo.com.br)
Date: 11/21/05

  • Next message: Omega: "problem with recvfrom"
    Date: Mon, 21 Nov 2005 18:23:46 +0000 (UTC)
    
    

    In article <dls8lk$gm3$1@chessie.cirr.com>,
    Andrei Voropaev wrote:

    > 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.

    As far as I am able to verify, only by closing the socket an RST will
    be sent if more data arrives. So, the ``doesn't do reading anymore''
    case doesn't seem to be true. If it is, how do you do it? My tests
    were made only on FreeBSD.


  • Next message: Omega: "problem with recvfrom"

    Relevant Pages

    • Re: TCP socket close problem
      ... Since my previous tcp issue was resolved by posting here, ... The client's socket is ... altogether on receipt of RST AFAIK. ... unacked data on the way to the client. ...
      (comp.unix.bsd.freebsd.misc)
    • Re: Socket weirdness
      ... If RST is at the top of the stack before the ... RST is not "seen" by the client until the first ACK to client *after ... a Shutdown.Receive by the server. ... some N factor of stocks or time and closes socket. ...
      (microsoft.public.dotnet.framework)
    • 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 ... that doesn't do reading anymore or is closed. ...
      (comp.unix.programmer)
    • Receiving Sockect connections request more than they are made, plz help.
      ... I am developing a Client and Host application ... host application accepts all requests and creates a thread for each ... In this case setup listener socket in read fdset ...
      (microsoft.public.win32.programmer.networks)
    • Re: TCP connection hang problem (resumes upon new TCP request)
      ... The client sends about 1.2 million requests through a TCP connection to server and server reads it. ... to the socket and the central guy stops reading from the socket. ... xx.xx.xx.xx 80) to the central distributor machine from another desktop ...
      (comp.os.linux.development.system)