# Localhost variability

**URL:** <https://rubytalk.org/t/localhost-variability/7989>\
**Category:** ruby-talk\
**Created:** [11 September 2003 19:13 UTC](https://rubytalk.org/t/localhost-variability/7989 "2003-09-11T19:13:38Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Gruby](https://avatars.discourse-cdn.com/v4/letter/g/58f4c7/32.png) [@Gruby](https://rubytalk.org/u/Gruby)\
**Post date:** [11 September 2003 19:13 UTC](https://rubytalk.org/t/localhost-variability/7989/1 "2003-09-11T19:13:38Z")

</div>

@host = “127.0.0.1”  
@port = “8080”  
@server = TCPserver.new(@host, @port)  
loop do  
Thread.start(@server.accept) do |con|  
hostname = con.addr[2]  
puts hostname  
end  
end

On my box (OS X 10.2.6, ruby 1.8), hostname is ‘localhost’.

On my developer’s box (FreeBSD 4.8 stable, ruby 1.8), hostname is  
’localhost.subdomain.domain’.

I think my box is correct. Is this a bug?

---

<div class="post-metadata">

**Author:** ![Laurent\_Julliard4](https://avatars.discourse-cdn.com/v4/letter/l/ebca7d/32.png) [@Laurent\_Julliard4](https://rubytalk.org/u/Laurent_Julliard4)\
**Post date:** [11 September 2003 22:14 UTC](https://rubytalk.org/t/localhost-variability/7989/2 "2003-09-11T22:14:41Z")

</div>

IMO  
it depends from /etc/hosts and the OS name resolution , not from ruby

> **···**
>
> il 11 Sep 2003 11:54:58 -0700, [gruby@sysarchitects.com](mailto:gruby@sysarchitects.com) (John) ha scritto::
> 
> > On my box (OS X 10.2.6, ruby 1.8), hostname is ‘localhost’.
> > 
> > On my developer’s box (FreeBSD 4.8 stable, ruby 1.8), hostname is  
> > ‘localhost.subdomain.domain’.
> > 
> > I think my box is correct. Is this a bug?
