Class: TCPSocket

Inherits:
Object
  • Object
show all
Defined in:
lib/tcp_socket.rb

Instance Method Summary collapse

Instance Method Details

#ready_to_read?(timeout = 5) ⇒ Boolean

Returns:

  • (Boolean)


6
7
8
9
# File 'lib/tcp_socket.rb', line 6

def ready_to_read?(timeout=5)
  r,_,__ = IO.select([self], nil, nil, timeout)
  return r.first == self
end

#remote_ipObject



2
3
4
# File 'lib/tcp_socket.rb', line 2

def remote_ip
  peeraddr.last.split(':').last
end