[IRCServices Coding] ircservices5.0a28 various

Andrew Church achurch at achurch.org
Mon Apr 15 10:09:16 PDT 2002


     I can comprehend the manual page just fine without any assistance,
thank you.  I was asking for someone who would be willing to actually test
this on both systems and see if it worked, not someone to explain it in
newbie-speak.

  --Andrew Church
    achurch at achurch.org
    http://achurch.org/

>On Monday 15 April 2002 03:54, Andrew Church wrote:
>>      If anyone would be willing to try to figure out and test a reliabl
>e
>> way to check for connectedness of non-blocking sockets on both Linux an
>d
>> FreeBSD, it would be much appreciated.  Remember that it has to work fo
>r
>> both successful and failed connections for both localhost (I'm not sure
>,
>> but connect() may return success even if non-blocking for 127.0.0.1) an
>d
>> remote hosts with reasonably high (>100ms) ping times.
>
>You do a connect().
>If connect returns 0 then the connection is established.
>If it returns -1 then you select() this fd for write.
>When select() indicates writeability then you use getsockopt():
>
>int	ret,n;
>ret=getsockopt(sockfd,SOL_SOCKET,SO_ERROR,&n,sizeof(n));
>
>ret==0 && n==0 means the socket is succesfuly connected
>when failed n has the same error code that connect() whould return if it 
>was a 
>blocking socket.
>
>>   --Andrew Church
><<V13>>
>------------------------------------------------------------------
>To unsubscribe or change your subscription options, visit:
>http://www.ircservices.za.net/mailman/listinfo/ircservices-coding