lib/polyphony/extensions/socket.rb
# call-seq:
#   socket.readpartial(maxlen) -> string
#   socket.readpartial(maxlen, buf) -> buf
#   socket.readpartial(maxlen, buf, buf_pos) -> buf
#   socket.readpartial(maxlen, buf, buf_pos, raise_on_eof) -> buf
#
# Reads up to `maxlen` from the socket. If `buf` is given, it is used as the
# buffer to read into, otherwise a new string is allocated. If `buf_pos` is
# given, reads into the given offset (in bytes) in the given buffer. If the
# given buffer offset is negative, it is calculated from the current end of
# the buffer (`-1` means the read data will be appended to the end of the
# buffer). If `raise_on_eof` is `true` (the default,) an `EOFError` will be
# raised on `EOF`, otherwise `nil` will be returned.
#
# If no bytes are available and `EOF` is not hit, this method will block until
# the socket is ready to read from.
#
# @param maxlen [Integer, nil] maximum bytes to read from socket
# @param buf [String, nil] buffer to read into
# @param buf_pos [Number] buffer position to read into
# @param raise_on_eof [bool] whether to raise an exception on `EOF`
# @return [String, nil] buffer used for reading or nil on `EOF`


Reads up to `maxlen` from the socket. If `buf` is given, it is used as the
buffer to read into, otherwise a new string is allocated. If `buf_pos` is
given, reads into the given offset (in bytes) in the given buffer. If the
given buffer offset is negative, it is calculated from the current end of
the buffer (`-1` means the read data will be appended to the end of the
buffer).

If no bytes are available and `EOF` is not hit, this method will block until
the socket is ready to read from.
Reads up to ` maxlen ` from the socket . If ` buf ` is given it is used as the buffer to read into otherwise a new string is allocated . If ` buf_pos ` is given reads into the given offset ( in bytes ) in the given buffer . If the given buffer offset is negative it is calculated from the current end of the buffer ( ` - 1 ` means the read data will be appended to the end of the buffer ) . If no bytes are available and ` EOF ` is not hit this method will block until the socket is ready to read from .
def readpartial(maxlen, str = +'', buffer_pos = 0, raise_on_eof = true)
    result = Polyphony.backend_recv(self, str, maxlen, buffer_pos)
    raise EOFError if !result && raise_on_eof
    result
  end
def readpartial ( maxlen , str = + '' , buffer_pos = 0 , raise_on_eof = true ) result = Polyphony . backend_recv ( self , str , maxlen , buffer_pos ) raise EOFError if ! result && raise_on_eof result end
call-seq:
socket.readpartial(maxlen) -> string
socket.readpartial(maxlen, buf) -> buf
socket.readpartial(maxlen, buf, buf_pos) -> buf
socket.readpartial(maxlen, buf, buf_pos, raise_on_eof) -> buf
call - seq : socket . readpartial ( maxlen ) - > string socket . readpartial ( maxlen buf ) - > buf socket . readpartial ( maxlen buf buf_pos ) - > buf socket . readpartial ( maxlen buf buf_pos raise_on_eof ) - > buf
buffer used for reading or nil on `EOF`
buffer used for reading or nil on ` EOF `
String, nil
maxlen
maximum bytes to read from socket
maximum bytes to read from socket
str
<not_specific>
buffer_pos
<not_specific>
raise_on_eof
whether to raise an exception on `EOF`
whether to raise an exception on ` EOF `
buf
<not_specific>
buffer to read into
buffer to read into
buf_pos
<not_specific>
buffer position to read into
buffer position to read into