PDA

View Full Version : "Custom" Web Server




bloodfist
Dec 8, 2005, 12:06 PM
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
Dec 8, 2005, 12:18 PM
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
Dec 8, 2005, 12:45 PM
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
Dec 8, 2005, 12:51 PM
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.

bloodfist
Dec 8, 2005, 12:56 PM
I got it working. Thanks a lot.

bloodfist