Method: TCPSocket#recv

Defined in:
lib/polyphony/extensions/socket.rb

#recv(maxlen, flags = 0, outbuf = nil) ⇒ String

Receives up to maxlen bytes from the socket. If outbuf is given, it is used as the buffer to receive into, otherwise a new string is allocated and used as buffer.

If no bytes are available, this method will block until the socket is ready to receive from.

Parameters:

  • maxlen (Integer)

    maximum bytes to receive

  • flags (Integer) (defaults to: 0)

    receive flags

  • outbuf (String, nil) (defaults to: nil)

    buffer for reading or nil to allocate new string

Returns:

  • (String)

    receive buffer



360
361
362
# File 'lib/polyphony/extensions/socket.rb', line 360

def recv(maxlen, flags = 0, outbuf = nil)
  Polyphony.backend_recv(self, outbuf || +'', maxlen, 0)
end