lib/steam/sockets/SteamSocket.php
/**
     * Reads the given amount of data from the socket and wraps it into the
     * buffer
     *
     * @param int $bufferLength The data length to read from the socket
     * @throws SocketException if an error occurs while reading data
     * @throws TimeoutException if no packet is received on time
     * @return int The number of bytes that have been read from the socket
     * @see ByteBuffer
     */
Reads the given amount of data from the socket and wraps it into the
buffer


Reads the given amount of data from the socket and wraps it into the buffer
public function receivePacket($bufferLength = 0) {
        if(!$this->socket->select(self::$timeout)) {
            throw new TimeoutException();
        }
        if($bufferLength == 0) {
            $this->buffer->clear();
        } else {
            $this->buffer = ByteBuffer::allocate($bufferLength);
        }
        try {
            $data = $this->socket->recv($this->buffer->remaining());
        } catch (SocketException $e) {
            if (defined('SOCKET_ECONNRESET') &&
                $e->getCode() == SOCKET_ECONNRESET) {
                $this->socket->close();
            }
            throw $e;
        }
        $this->buffer->put($data);
        $bytesRead = $this->buffer->position();
        $this->buffer->rewind();
        $this->buffer->limit($bytesRead);
        return $bytesRead;
    }
public function receivePacket ( $ bufferLength = 0 ) { if ( ! $ this -> socket -> select ( self :: $ timeout ) ) { throw new TimeoutException ( ) ; } if ( $ bufferLength == 0 ) { $ this -> buffer -> clear ( ) ; } else { $ this -> buffer = ByteBuffer :: allocate ( $ bufferLength ) ; } try { $ data = $ this -> socket -> recv ( $ this -> buffer -> remaining ( ) ) ; } catch ( SocketException $ e ) { if ( defined ( 'SOCKET_ECONNRESET' ) && $ e -> getCode ( ) == SOCKET_ECONNRESET ) { $ this -> socket -> close ( ) ; } throw $ e ; } $ this -> buffer -> put ( $ data ) ; $ bytesRead = $ this -> buffer -> position ( ) ; $ this -> buffer -> rewind ( ) ; $ this -> buffer -> limit ( $ bytesRead ) ; return $ bytesRead ; }
Reads the given amount of data from the socket and wraps it into the
 buffer
Reads the given amount of data from the socket and wraps it into the buffer