basicsocket.getpeername => sockaddr
Instance Public methods
Returns the remote address of the socket as a sockaddr string.
1 2 3 4 5 | TCPServer.open( "127.0.0.1" , 1440 ) {|serv| c = TCPSocket. new ( "127.0.0.1" , 1440 ) s = serv.accept p s.getpeername #=> "\x02\x00\x82u\x7F\x00\x00\x01\x00\x00\x00\x00\x00\x00\x00\x00" } |
If Addrinfo object is preferred over the binary string, use #remote_address.
Please login to continue.