mrblib/mrb_simplehttpserver.rb
def receive_data(io)
    data = nil
    time = Time.now if @nonblock
    ext  = String.method_defined? :<<

    loop do
      begin
        buf = io.recv(RECV_BUF, @nonblock ? Socket::MSG_DONTWAIT : 0)

        if !data
          data = buf
        elsif ext
          data << buf
        else
          data += buf
        end

        return data if buf.size != RECV_BUF
      rescue
        next if (Time.now - time) < @timeout
      end
    end
  end
# Receive data from the socket in a loop until all data have been received.
# Might break out of the loop in case of a timeout.
#
# @param [ BasicSocket ] io The tcp socket from where to read the data.
#
# @return [ String ] nil if no data could be read.
Receive data from the socket in a loop until all data have been received.
Might break out of the loop in case of a timeout.
Receive data from the socket in a loop until all data have been received . Might break out of the loop in case of a timeout .
def receive_data(io)
    data = nil
    time = Time.now if @nonblock
    ext  = String.method_defined? :<<
    loop do
      begin
        buf = io.recv(RECV_BUF, @nonblock ? Socket::MSG_DONTWAIT : 0)
        if !data
          data = buf
        elsif ext
          data << buf
        else
          data += buf
        end
        return data if buf.size != RECV_BUF
      rescue
        next if (Time.now - time) < @timeout
      end
    end
  end
def receive_data ( io ) data = nil time = Time . now if @nonblock ext = String . method_defined? :<< loop do begin buf = io . recv ( RECV_BUF , @nonblock ? Socket :: MSG_DONTWAIT : 0 ) if ! data data = buf elsif ext data << buf else data += buf end return data if buf . size != RECV_BUF rescue next if ( Time . now - time ) < @timeout end end end
Receive data from the socket in a loop until all data have been received.
Receive data from the socket in a loop until all data have been received .
nil if no data could be read.
nil if no data could be read .
 String 
io
io The tcp socket from where to read the data.
io The tcp socket from where to read the data .