protected function write($socket, $value)
    {
        $value = $this->serialize($value) . PHP_EOL;
        $written = 0;
        while ($written < strlen($value)) {
            $bytes = fwrite($socket, substr($value, $written));
            if ($bytes === false) {
                return false;
            }
            $written += $bytes;
        }
        return true;
    }
protected function write($socket, $value)
    {
        $value = $this->serialize($value) . PHP_EOL;
        $written = 0;
        while ($written < strlen($value)) {
            $bytes = fwrite($socket, substr($value, $written));
            if ($bytes === false) {
                return false;
            }
            $written += $bytes;
        }
        return true;
    }
protected function write ( $ socket , $ value ) { $ value = $ this -> serialize ( $ value ) . PHP_EOL ; $ written = 0 ; while ( $ written < strlen ( $ value ) ) { $ bytes = fwrite ( $ socket , substr ( $ value , $ written ) ) ; if ( $ bytes === false ) { return false ; } $ written += $ bytes ; } return true ; }
Write data with serialize to a socket.

@param   resource  $socket
@param   mixed     $value
@return  boolean
Write data with serialize to a socket .