Re: TCP connect in Non Blocking Mode



David Schwartz wrote:
Acutally, select() poll() do NOT check for readablity but for
the ability to call read() without being blocked in the call.
Since the connection is refused by the RST, read() should
return iommediately with result -1 and errno set to ECONNREFUSED.
And select() should indicate that a read() can be called without
being blocked.

But a 'write' can be called without being blocked too, so checking for
readability is at best redundant. If the connection succeeds, it will
be writable but not readable, so checking for 'read'ability won't
detect connection success.

This is why the typical pattern is to check an asynchronous 'connect'
attempt only for writability.

Whether a socket will become readable after connect
also depends on the protocol used ... SMTP and FTP
are exaples of protocols where the serverside
will send an immediate message to the client
after successful connection.
Anyhow, my suggestion was to set the bit in the readset
as well as in the writeset. You might regard this as redundant
but (as even you had to admit) it will not harm.
By the way ... setting the bit in the exceptionset will also
not harm.

Rainer
.



Relevant Pages

  • Re: SSL vs. SSL over tcp/ip
    ... that were at different places in the internet backbone ... hierarchical routing (part of the problem was anarchy routing was ... that was only true once the connection was made. ... kernels and tcp/ip protocol stack ... ...
    (comp.security.misc)
  • More info (Re: ppp dialin problems: mgetty and ppp.conf)
    ... connection to the Internet, however, it appears that if I maintain the ... slots with slot compression ... 0x8057 (Internet Protocol V6 Control Protocol) was rejected! ...
    (freebsd-questions)
  • Re: NetworkFacade 0.4
    ... This means that the protocol is similar to DRb, but different, ... with regards to connection caching and what happens if connections are ... can be made in both directions down the same socket. ... hostname and a port on the firewall which forwards inbound connections. ...
    (comp.lang.ruby)
  • Re: PPPoE
    ... The Windows driver README ... Installing the PPP over Ethernet Protocol ... Connection Sharing, ...
    (freebsd-net)
  • Re: Processs PreciseMail AntiSpam Gateway - any experience so far ?
    ... >>This protocol is designed to be used between domain Email Service ... > randomly generated the port number and communicated that back to the sender ... > before closing the connection. ... if the receiver ESP can make that work. ...
    (comp.os.vms)