Ejemplo n.º 1
0
 public function recv()
 {
     $rawResponse = '';
     do {
         $bytesRead = $this->clientSocket->read($buffer, 1024);
         if ($bytesRead > 0) {
             $rawResponse .= $buffer;
         } else {
             break;
         }
     } while ($rawResponse[strlen($rawResponse) - 1] != '\\n');
     if ($rawResponse) {
         return JsonResponse::parse($rawResponse);
     }
     return null;
 }