Obtaining ip address of client socket in ruby

How can I obtain the ip address of the originating (client) socket ,
in a server/client socket ruby program?

What ruby library is fitted with a class/ method to do this?
How can it be done using ruby?

I would appreciate some sample code.

2007/11/24, Victor R. [email protected]:

How can I obtain the ip address of the originating (client) socket ,
in a server/client socket ruby program?

What ruby library is fitted with a class/ method to do this?
How can it be done using ruby?

I would appreciate some sample code.

http://www.ruby-doc.org/docs/ProgrammingRuby/html/lib_network.html

robert

From: “Robert K.” [email protected]

2007/11/24, Victor R. [email protected]:

How can I obtain the ip address of the originating (client) socket ,
in a server/client socket ruby program?

What ruby library is fitted with a class/ method to do this?
How can it be done using ruby?

I would appreciate some sample code.

Programming Ruby: The Pragmatic Programmer's Guide

sock_domain, remote_port, remote_hostname, remote_ip = socket.peeraddr

note: sock_domain is the address family, e.g. “AF_INET”

Regards,

Bill