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.

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

robert

···

2007/11/24, Victor Rosillo <victorrosillo@gmail.com>:

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.

--
use.inject do |as, often| as.you_can - without end

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

···

From: "Robert Klemme" <shortcutter@googlemail.com>

2007/11/24, Victor Rosillo <victorrosillo@gmail.com>: