2014-06-14 10:55 GMT+02:00 Ben Coman <[email protected]>:

>  Luc Fabresse wrote:
>
>
>
> 2014-06-14 6:04 GMT+02:00 Ben Coman <[email protected]>:
>
>>  Luc Fabresse wrote:
>>
>> Hi,
>>
>>  I experiencing a strange difference between localhost and 127.0.0.1.
>>
>>  In Pharo I do:
>>
>>  (ZnServer startDefaultOn: 4444)
>>     onRequestRespond: [ :request | ZnResponse ok: (ZnEntity text:
>> 'hello') ]
>>
>>  In bash:
>>
>>  $ lsof -Pi | grep Pharo
>> Pharo     2718  luc    7u  IPv4 0x1e64a2e9381f409b      0t0  TCP *:4444
>> (LISTEN)
>>
>>  I perfectly listen on port 4444 from all interfaces *
>>
>>  $ curl http://127.0.0.1:4444
>> hello
>>
>>  $ curl http://localhost:4444
>>  curl: (7) Failed to connect to localhost port 4444: Connection refused
>>                     *<- why ?*
>>
>>  localhost is correctly resolved on my mac
>>  $ ping localhost
>> PING localhost (127.0.0.1): 56 data bytes
>> 64 bytes from 127.0.0.1: icmp_seq=0 ttl=64 time=0.044 ms
>>
>>  I tested with other programs than Zinc to open listening sockets and it
>> works.
>>
>>  Any idea?
>>
>> #Luc
>>
>>  maybe http://sourceforge.net/p/curl/bugs/1337/
>>
>
>  Humm, I use curl 7.36.0, so yes perhaps this bug fix is not integrated...
>
>  Anyway, I was also suspecting curl but I tested with server: Apache on
> port 8888 and here curl works:
>
>  httpd     621  luc    5u  IPv6 0x6ea19c1d988f10db      0t0  TCP *:8888
>  <-- same as Zinc
>
>
> Yes. If the *:8888 means that Apache was listening on "all" IP addresses
> rather than just 127.0.0.1, then as you can see it was an IPv6 address that
> curl connected to.
>

ah right, I did not read the beginning of the line ;-)

So now it is clearer.
I conclude that it is a curl bug only for ipv4


>
> btw, What do you get from `nslookup localhost` ?
>

$ nslookup localhost
Server: 192.168.0.254
Address: 192.168.0.254#53

Name: localhost
Address: 127.0.0.1


> Anyway, the question then becomes... How well does Pharo / Zinc play with
> IPv6 ?
>

the Socket plugin supports some things but I do not remember now.

Thx,

Luc



>
> cheers -ben
>
>
>  but both:
>
>  curl http://127.0.0.1:8888
>  curl http://localhost:8888
>
>  are working.
>
>  wget always works (Apache and Zinc):
>
>  wget -qO- http://127.0.0.1:8888
>  wget -qO- http://localhost:8888
>
>  Thanks Max and Ben,
>
>  Luc
>
>
>

Reply via email to