Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

bloodfist

macrumors member
Original poster
Apr 30, 2005
40
0
I am taking a networking course here at school and we are working on servers right now. Right now, we are working on a "web server", and when I compile and run the server, I can't connect to it from Safari (http://127.0.0.1:XXXXX, where XXXXX is the servers port number).

The server we wrote before this worked fine. We had a server we wrote running and then a client we wrote ourselves connecting to that server.

Does OS X have any security built in that prevents a web browser from connecting to a server running on the local machine?

If this isn't clear, let me know.

Thanks.

bloodfist

EDIT - Here is the actual error from Safari
Safari can’t open the page “http://localhost:52198/” because it could not connect to the server “localhost”.
 

jeremy.king

macrumors 603
Jul 23, 2002
5,479
1
Holly Springs, NC
You should check to make sure your machine is listening on port XXXXX by using the netstat command in Terminal.

To learn more about netstat type man netstat in Terminal

Also, you can configure the OS X firewall in Preferences > Sharing and select the Firewall tab.
 

bloodfist

macrumors member
Original poster
Apr 30, 2005
40
0
I tried the webserver and it doesn't show up with netstat. So I went back to the previous assignment, and it didn't show up in netstat until after I connected to it with the client.

I turned the firewall off, even though I don't see how it would prevent my machine from connecting to itself.

I'll look through the netstat man pages a little more here.

Thanks for your help.

bloodfist
 

jeremy.king

macrumors 603
Jul 23, 2002
5,479
1
Holly Springs, NC
bloodfist said:
I turned the firewall off, even though I don't see how it would prevent my machine from connecting to itself.

Well it's so secure, it doesn't trust itself :)

Glad you got it working but you may want to just poke a hole (ie configure new port in Sharing pref) in your firewall rather than disabling it (risky). That is, unless you are behind a router that has some level of firewall protection.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.