Re: TCP connect in Non Blocking Mode



Prabhu wrote:
err = connect(sd, (struct sockaddr*) &sa, sizeof(sa));
.....
l_fds=select(sd+1, NULL,&filedes_set,NULL,&l_connect_timeout);

This works fine. The issue that I face is when the server refuses
connection by sending RST for the SYN from client. The select waits
for 30 seconds and later returns timing out. RST though is sent
immediately by the server. The client application need to capture the
RST as soon as it arrives. How do we achieve that. Why does not the
select return immediately when the RST arrives at client?

Have you tried to select() the filedescriptor for read (in the
read-fd-set) as well?
.



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: 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)
  • Re: TCP socket close problem
    ... use for the RST anymore - the seq number of those RSTs is taken from the ... acceptable by the server. ... probably most likely at the client end, ... Client asks for something that the server will send in 2 packets. ...
    (comp.unix.bsd.freebsd.misc)