Hello, > Marek Marcola wrote: > > For example: > > > > /* check socket error state - only if val == 0 after this call > > * connection is properly established. > > */ > > len = sizeof(int); > > if (getsockopt(fd, SOL_SOCKET, SO_ERROR, (void *) &state, &len) < 0) { > > goto err; > > } > > > > if (state != 0) { > > /* socket state error - setting errno */ > > errno = state; > > goto err; > > } > > > > Or maybe I doing too much ? > > Yes. > > connect() will return 0 on success. From that point on you use can use > readability indication and read() to detect closed/timeout connection. > > connect() will return -1/INPROGRESS when it still waiting for the > network layer to conclude the connection attempts. Right now the TCP > layer is automatically retransmissing connection requests (SYN_SENT state). > > connect() will return -1 and anything else on failure. Some possible > return values maybe ETIMEDOUT, ENETDOWN, ENETUNREACH, ENETRESET, etc... > But all of these a fatal errors and mean the same thing, but can > provide a finer grained reasoning for the cause of failure. > > ETIMEDOUT the connection requests just timed out after maximum retries. > ENETDOWN the local host's network interface is not operational. > ENETUNREACH a remote network returned ICMP network unreachables for the > network. > ENETRESET the request port is not available for inbound connections at > that address. > EHOSTUNREACH a remote network returned ICMP host unreachables for the > address. I've forget to tell that i'm not doing second connect(). Just: - connect() - select() - getsockopt() Thanks for information.
Best regards, -- Marek Marcola <[EMAIL PROTECTED]> ______________________________________________________________________ OpenSSL Project http://www.openssl.org User Support Mailing List openssl-users@openssl.org Automated List Manager [EMAIL PROTECTED]