# Ip address of client from GServer#serve

**URL:** <https://www.ruby-forum.com/t/ip-address-of-client-from-gserver-serve/158119>\
**Category:** Ruby\
**Created:** [January 19, 2009, 3:10pm UTC](https://www.ruby-forum.com/t/ip-address-of-client-from-gserver-serve/158119 "2009-01-19T15:10:38Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![juba](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/5daacb/32.png) [@juba](https://www.ruby-forum.com/u/juba)\
**Post date:** [January 19, 2009, 3:10pm UTC](https://www.ruby-forum.com/t/ip-address-of-client-from-gserver-serve/158119/1 "2009-01-19T15:10:38Z")

</div>

Hi,

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

Regards,

Julien

---

<div class="post-metadata">

**Author:** ![juba](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/5daacb/32.png) [@juba](https://www.ruby-forum.com/u/juba)\
**Post date:** [January 19, 2009, 3:44pm UTC](https://www.ruby-forum.com/t/ip-address-of-client-from-gserver-serve/158119/2 "2009-01-19T15:44:38Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![juba](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/5daacb/32.png) [@juba](https://www.ruby-forum.com/u/juba)\
**Post date:** [January 19, 2009, 4:01pm UTC](https://www.ruby-forum.com/t/ip-address-of-client-from-gserver-serve/158119/3 "2009-01-19T16:01:34Z")

</div>

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](http://www.ruby-doc.org/core/classes/GServer.html)).
