sockets
| From: | Ian Newlands | Date: | Wed, 13 Nov 2002 16:21:05 +0000 |
| Subject: | sockets | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-124232@lists.php.net to get a copy of this message | ||
I am in the beginning stages of writing my first socket based php app from
scratch. However I think I've quickly picked up a bad coding habbit when
reading from sockets. I'm doing the following:
//writing the socket
socket_write ($socket,"blah blah$CRLF", strlen ($in));
//sleeping for 1 second...
sleep(1);
//after sleeping, i'll check to see if there is input...
$output = socket_read($socket,1024);
Can anyone give me a better example of how I should be doing this? I could
get events sent back at any time. I tried the example on the php.net's
documentation (binding and accepting) but it failed to work for me on the
latest php (4.3.0pre2). It just kept timing out for me.