Ip address of client from GServer#serve

Hi,

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

Regards,

Julien

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

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 forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs