Re: Other socket stuff

From: Date: Wed, 26 May 1999 17:08:03 +0000
Subject: Re: Other socket stuff
References: 1  Groups: php.dev 
Request: Send a blank email to php-dev+get-6023@lists.php.net to get a copy of this message
> Well, one can do nonblocking connects. When a TCP socket is set nonblocking > and then connect is called, connect returns immediately with an error of > EINPROGRESS but the TCP three-way handshake continues. We then check for > either a successful or unsuccessful completion of the connection establishment > using select. > > The described technique avoids the problem with borrowing Apache's reserved > signal. True, perhaps this falls into a more general-purpose user-level select() call then. I realize we could implement this internally and hide the functionality from the user, but there have been requests for the ability to open up multiple sockets and be able to asynchronously manage them. I don't really want to get into asynchronous events here, but something like: $s1 = fsockopen(...); $s2 = fsockopen(...); $ret = select(array($s1,$s2),3); // 3-second timeout echo "$ret responded first"; might do the trick. If the first argument is not an array, it could be assumed that it is just a single descriptor. > We should reserve ALRM for other things. I think it would be a great > improvement, if a user could time out all functions. That could be efficiently > implemented using alarm(2). Right, that's not a bad idea. -Rasmus -- PHP Development Mailing List http://www.php.net/ To unsubscribe send an empty message to php-dev-unsubscribe@lists.php.net For help: php-dev-help@lists.php.net

« previous php.dev (#6023) next »