Forum: Ruby ip address of client from GServer#serve

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Julien B. (Guest)
on 2009-01-19 16:10
(Received via mailing list)
Hi,

I would like to know if there is a way to take the ip address of client
from GServer#serve.

Regards,

Julien
Brian C. (Guest)
on 2009-01-19 16:44
Julien B. wrote:
> I would like to know if there is a way to take the ip address of client
> from GServer#serve.

Try this:

def serve(myClient)
  p myClient.peeraddr
end
Julien B. (Guest)
on 2009-01-19 17:01
(Received via mailing list)
thanks, it works.
I should have considered the GServer#serve parameter as a socket and not
just as an io (cf http://www.ruby-doc.org/core/classes/GServer.html).
This topic is locked and can not be replied to.