# Socket#getaddrinfo works in console but not in server

**URL:** <https://www.ruby-forum.com/t/socket-getaddrinfo-works-in-console-but-not-in-server/163119>\
**Category:** Rails\
**Created:** [March 17, 2009, 1:36pm UTC](https://www.ruby-forum.com/t/socket-getaddrinfo-works-in-console-but-not-in-server/163119 "2009-03-17T13:36:11Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![zaczheng](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/z/edb3f5/32.png) [@zaczheng](https://www.ruby-forum.com/u/zaczheng)\
**Post date:** [March 17, 2009, 1:36pm UTC](https://www.ruby-forum.com/t/socket-getaddrinfo-works-in-console-but-not-in-server/163119/1 "2009-03-17T13:36:11Z")

</div>

I am experiencing a strange problem with Socket#getaddrinfo. It  
correctly resolves IPs into hostnames while in console mode, but does  
not when run in server mode.

When in server mode, it simply returns the original IP unresolved.

Can anyone comment on this behaviour?

Much thanks  
Zac

---

<div class="post-metadata">

**Author:** ![zaczheng](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/z/edb3f5/32.png) [@zaczheng](https://www.ruby-forum.com/u/zaczheng)\
**Post date:** [March 18, 2009, 10:33am UTC](https://www.ruby-forum.com/t/socket-getaddrinfo-works-in-console-but-not-in-server/163119/2 "2009-03-18T10:33:58Z")

</div>

Zac Z. wrote:

> I am experiencing a strange problem with Socket#getaddrinfo. It  
> correctly resolves IPs into hostnames while in console mode, but does  
> not when run in server mode.
> 
> When in server mode, it simply returns the original IP unresolved.
> 
> Can anyone comment on this behaviour?
> 
> Much thanks  
> Zac

Since it’s annoying reading a coding problem without code, I have made a  
pastie:  
[http://pastie.org/419562](http://pastie.org/419562)

Any help will be gratefully received.

Zac
