Re: World's simplest tutorial on socket_select???

From: Date: Thu, 20 May 2004 22:19:36 +0000
Subject: Re: World's simplest tutorial on socket_select???
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-186636@lists.php.net to get a copy of this message
René fournier wrote:
I've seen a sweet script for a multi-client, multi-socket server in PHP (http://dave.dapond.com/socketselect.php.txt), but its purpose is quite different from mine, and it's about one billion times more complex than I need. I am building a SIMPLE socket client that makes ONE connection to ONE server, and waits for data (socket_read)... and when no data comes for a few seconds, does something else, then waits for data again. HOW SHOULD I APPROACH THIS?! PLEASE TOSS ME A BONE! (If you help me, I will buy you a pint of great beer.) ...Rene
Just set a receive timeout and check socket_last_error() for a timeout error if socket_read() fails. socket_set_option($sock, SOL_SOCKET, SO_RCVTIMEO, 5); Of course, I could be wrong about this. ;-) -- paperCrane <Justin Patrin>

« previous php.general (#186636) next »