Re: Sockets Extension Rework (API, etc...) VERY LONG
| From: | Harald Radi | Date: | Sat, 23 Feb 2002 12:34:13 +0000 |
| Subject: | Re: Sockets Extension Rework (API, etc...) VERY LONG | ||
| Groups: | php.dev | ||
| Request: | Send a blank email to php-dev+get-80323@lists.php.net to get a copy of this message | ||
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
> vs.
>
> while(($retval==socket_read($sock, $buf, $len)) > 0) {
> // do something
> }
> if ($retval==-1) {
> print strerror(socket_last_error($sock));
> } elseif ($retval==0) {
> $eof=1;
> print "Eof has occured!!!";
> }
what about
while(socket_read($sock, $buf, $len)) {
// do somthing
}
switch (socket_last_error($sock)) {
case SOCKET_EOF:
print "eof";
break;
default:
print strerror(socket_last_message($sock));
}
harald.
-----BEGIN PGP SIGNATURE-----
Version: PGP 7.0.4
iQA/AwUBPHeMRK1+myS9SSHxEQK7TgCcCP8Z4vdnVfFOhjhBX+y/WBQ196UAoKl1
BPYcQ7yUWFo/O0VeJwf/9lE6
=xYWI
-----END PGP SIGNATURE-----