Ping is waiting forever
Brought to you by:
masham
A small but very sensitive point on using Ping to keep connection alive. But when it goes offline we have to apply timeout on that request. Here is my quick hack, the solution could be more general.
function send_request($action, $parameters=array()) { $req = "Action: $action\r\n"; foreach($parameters as $var=>$val) $req .= "$var: $val\r\n"; $req .= "\r\n"; fwrite($this->socket, $req); if ($action != 'Ping'){ return $this->wait_response(); } else { return $this->wait_response(TRUE); } }