Re: Socket weirdness



Dave Sexton wrote:
Hi William,

Here are a few questions that I still cannot answer:

1. If shutting down receive on a socket blocks incoming data, does the socket respond with anything when data is actually sent from the peer?

Not when data is sent by peer, but when data from peer is received. Once that RST segment reaches poor sender, all subsequent operation (both read and send), should fail with "Connection reset".

server: Shutdown.Recieve
client: send ok
client: send ok
server: receives data -> send back RST immediatly
client: send ok
client: send ok
client: TCP stack receives RST
client: send failes with "Connection reset"
client: send failes with "Connection reset"
client: send failes with "Connection reset"
....

2. What actually is sent; ACK or RST, ACK and RST, nothing, or something else?

RST.

3. Is the response immediate?

Sort of. It should RST when data is received that cannot be delivered to application. It may take a while to reach the other side and also that RST packet could be lost.

4. Does a blocking Send wait for a response before returning to the caller?

Sort of. If OS has enaugh buffer space it will buffer and return immediatly. If not, it will wait for ACK from other side that will free some buffer space.

5. If Send does wait for a response, why doesn't the initial call to Send fail when RST is received (this question is derived from how I've understood Alan's explanation thus far)?

See 4.

6. Does BeginSend wait for a response before returning to the caller (I hope not)? Does EndSend wait for a response?


BeginSend should not. EndSend I'm not sure...

....

Regards,
Goran
.



Relevant Pages

  • Re: Socket weirdness
    ... Once that RST segment reaches poor sender, ... client: send ok ... send failes with "Connection reset" ... If OS has enaugh buffer space it will buffer and return immediatly. ...
    (microsoft.public.dotnet.framework)
  • 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: CAsyncSocket performing RST on Connect()
    ... I have a windows client that opens a tcp connection and sometimes ... the connection underneath sends a RST just like in your trace. ...
    (microsoft.public.win32.programmer.networks)
  • Re: WSE 2.0 SP2: UsernameTokens must be encrypted to request SCT?
    ... UsernameToken to sign the initial RST. ... In WSE2 SP2 we require the client to ... have encrypted the username token somehow, either with a Servers Cert, or ... >> are using SSL or have a SCT and can encrypt them. ...
    (microsoft.public.dotnet.framework.webservices.enhancements)
  • 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)

Loading