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>

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Reply via email to