Re: Socket weirdness



Hi Goran,

Thanks very much for your response. As it turns out, I still have a lot of questions even though you've answered a few (but you've
created some more :).

I still have yet to answer the question, "Why doesn't the initial blocking Send fail?". I believe now that there are many forces at
work here affecting the answer to my question and that the behavior of some of the socket functions are simply indeterministic due
to network latency, including the blocking Send itself. What, exactly, does a blocking send do that requires it to block?

I'm gonna have to hit the books.

Something else that might be of interest to readers, which I found browsing around for more info on the subject of TCP/IP:

Nagle Algorithm on Wikipedia.org:
http://en.wikipedia.org/wiki/Nagel_algorithm

--
Dave Sexton

"Goran Sliskovic" <gsliskov@xxxxxxxxx> wrote in message news:O4OTojR3GHA.4228@xxxxxxxxxxxxxxxxxxxxxxx
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
    ... 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: Socket weirdness
    ... If shutting down receive on a socket blocks incoming data, does the socket respond with anything when data is actually sent from the peer? ... Once that RST segment reaches poor sender, all subsequent operation, should fail with "Connection reset". ... client: send ok ... send failes with "Connection reset" ...
    (microsoft.public.dotnet.framework)
  • 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)