views:

244

answers:

3

I'm trying to connect to a webserver that's running on my mac OSX 1.6. I'm able to connect to it locally using http://127.0.0.1:8888/myapp but when I attempt to connect to it using my machine's local IP address (http://192.168.1.15:8888/myapp IP shown below) from the same machine (or another on the network) I cannot connect. I can ping the LAN IP address.

I've tried adding IP forwarding to my router for port 8888 but it didn't help. I've checked and the OSX firewall is disabled

Can anyone suggest what else is blocking the connection?

Here's what I get when I run ifconfig:

~ :ifconfig
lo0: flags=8049<UP,LOOPBACK,RUNNING,MULTICAST> mtu 16384
    inet6 ::1 prefixlen 128 
    inet6 fe80::1%lo0 prefixlen 64 scopeid 0x1 
    inet 127.0.0.1 netmask 0xff000000 
gif0: flags=8010<POINTOPOINT,MULTICAST> mtu 1280
stf0: flags=0<> mtu 1280
en0: flags=8863<UP,BROADCAST,SMART,RUNNING,SIMPLEX,MULTICAST> mtu 1500
    ether 00:1f:5b:e8:16:4d 
    media: autoselect status: inactive
    supported media: autoselect 10baseT/UTP <half-duplex> 10baseT/UTP <full-duplex> 10baseT/UTP <full-duplex,hw-loopback> 10baseT/UTP <full-duplex,flow-control> 100baseTX <half-duplex> 100baseTX <full-duplex> 100baseTX <full-duplex,hw-loopback> 100baseTX <full-duplex,flow-control> 1000baseT <full-duplex> 1000baseT <full-duplex,hw-loopback> 1000baseT <full-duplex,flow-control> none
en1: flags=8863<UP,BROADCAST,SMART,RUNNING,SIMPLEX,MULTICAST> mtu 1500
    inet6 fe80::21e:c2ff:febf:4809%en1 prefixlen 64 scopeid 0x5 
    inet 192.168.1.15 netmask 0xffffff00 broadcast 192.168.1.255
    ether 00:1e:c2:bf:48:09 
    media: autoselect status: active
    supported media: autoselect
fw0: flags=8802<BROADCAST,SIMPLEX,MULTICAST> mtu 4078
    lladdr 00:1f:5b:ff:fe:2b:b3:3c 
    media: autoselect <full-duplex> status: inactive
    supported media: autoselect <full-duplex>
en5: flags=8822<BROADCAST,SMART,SIMPLEX,MULTICAST> mtu 1500
    ether 00:1e:c2:8e:0f:45 
    media: autoselect status: inactive
    supported media: none autoselect 10baseT/UTP <half-duplex>
en2: flags=8922<BROADCAST,SMART,PROMISC,SIMPLEX,MULTICAST> mtu 1500
    ether 00:1c:42:00:00:00 
    media: autoselect status: inactive
    supported media: autoselect
en3: flags=8922<BROADCAST,SMART,PROMISC,SIMPLEX,MULTICAST> mtu 1500
    ether 00:1c:42:00:00:01 
    media: autoselect status: inactive
    supported media: autoselect
A: 

Your webserver is probably binding to the loopback interface by default. Applications can "bind" to specific interfaces - if it only listens on the loopback interface, you'll be able to connect via a 127.x.x.x ip but not an external ip. You can look at the "Network Utility" -> Netstat -> display state of all socket connections, which will display all open sockets. Further debugging will require the relevant lines from this (probably the one on port 8888) and potentially what webserver you're running...

Steven Schlansker
Thanks Steven,I ran netstat but don't see any mention of port 8888. Running "netstat -a | grep 8888" returns nothing. My server (jetty) is still running and responding locally.
Alex Worden
It probably shows up as http-alt or something like that?
Steven Schlansker
+1  A: 

Unless this is programming related this question might belong on ServerFault or SuperUser.

In any case, if you are writing an application on Mac OS perhaps you need to specify the exact interface your application is listening on.

TimothyP
Hi - I'm not exactly trying to configure a server - I'm developing locally and trying to connect to a Jetty application server that's hosting my GWT application. I'm not sure what you mean by "specify the exact interface". Do you mean protocol?
Alex Worden
Hi,No, It is very likely you have multiple interfaces , such as the ethernet interface, the wlan interface and of course the loopback interface. (fw0, en0, en1, lo0) You might have to be very specific about the interfaces on which your application has to listen for incoming requests.
TimothyP
A: 

BTW - I think this was user error. I think I was probably running GWT in hosted mode with a Firefox plugin. There was no webserver running or listening to port 8888 which is why it didn't show up!

Alex Worden