RE: [PHP] Socket how to die if connection broken
| From: | Instruct ICC | Date: | Mon, 08 Oct 2007 19:03:50 +0000 |
| Subject: | RE: [PHP] Socket how to die if connection broken | ||
| References: | 1 2 3 4 5 6 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-262929@lists.php.net to get a copy of this message | ||
> I dont get that error
>
> Warning: socket_write() expects parameter 1 to be resource, null given in
> /path/script.php on line 34
>
> but just the original error msg
>
> Warning: socket_write(): unable to write to socket [32]: Broken pipe in
Multiple times still?
Or just the one time?
Use http://php.he.net/manual/en/function.socket-last-error.php
if (false === socket_write($sock, $buffer))
{
$errorcode = socket_last_error();
$errormsg = socket_strerror($errorcode);
//socket_close($sock);//Doubt if this is needed if $sock isn't good
exit("ERROR: [$errorcode] $errormsg");
}
_________________________________________________________________
Climb to the top of the charts! Play Star Shuffle: the word scramble challenge with star power.
http://club.live.com/star_shuffle.aspx?icid=starshuffle_wlmailtextlink_oct