RE: Socket how to die if connection broken

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



> 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

[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux