Subject: Re: ALERT: Solaris 2.5.1 locks up on TCP connections in Pine 3.9x

From: [email-masked] (Casper H.S. Dik)
Date: 26 Nov 1996 10:24:07 +0100

Mark Crispin <[email-masked]> writes:

>2) The 0 byte read serves a purpose.  On all systems except Solaris, it
>   enables Pine to report a TCP/IP connection failure after doing a
>   blocking select().  Otherwise, a failure to open the connection will
>   not be detected until Pine tries to read data from the connection, and
>   it will report the wrong message.

It still is bad programming; the proper way to do a non-blocking connect is
to retry the connect you eitehr get an already connected error or
a timeout.

>Because of this Solaris operating system bug, we are using a different
>technique in Pine 4.00.

But it is a bug in Solaris 2.x, we can agree on that.

I'm not sure, but wouldn't be entirely suprised if POSIX standards allowed
a read of 0 to return 0 always and immediately on any valid fd.

Casper
-- 
Casper Dik - Sun Microsystems - via my guest account at the University
of Amsterdam.  My work e-mail address is: [email-masked]
Statements on Sun products included here are not gospel and may
be fiction rather than truth.

---

From: [email-masked] (Andreas Borchert)
Date: 29 Nov 1996 15:00:03 GMT

> to retry the connect you eitehr get an already connected error or

There may be several ways to setup asynchronous connects but probably
it is best to use the method that is suggested by the associated
man pages -- in this case getsockopt(3N):

     SO_ERROR returns any pending error on the socket and clears the
     error status.  It may  be used  to check for asynchronous errors
     on connected datagram sockets or for other asynchronous errors.

This should work on all platforms which support BSD sockets.

Andreas.

-- 
Andreas Borchert, Universitaet Ulm, SAI, Helmholtzstr. 18, 89069 Ulm,  Germany
E-Mail: [email-masked]
WWW:	http://www.mathematik.uni-ulm.de/sai/borchert/
PGP key available via ``finger [email-masked]''