bsock.remote_address => addrinfo
Instance Public methods
Returns an Addrinfo object for remote address obtained by getpeername.
Note that addrinfo.protocol is filled by 0.
1 2 3 4 5 6 7 8 9 | TCPSocket.open( "www.ruby-lang.org" , 80 ) {|s| p s.remote_address #=> #<Addrinfo: 221.186.184.68:80 TCP> } TCPServer.open( "127.0.0.1" , 1728 ) {|serv| c = TCPSocket. new ( "127.0.0.1" , 1728 ) s = serv.accept p s.remote_address #=> #<Addrinfo: 127.0.0.1:36504 TCP> } |
Please login to continue.