Archived

This topic is now archived and is closed to further replies.

Shannon Barber

bind/listen/127.0.0.1

Recommended Posts

Shannon Barber    1681
I finally started to test my socket code across the network (had everything on the same box before) and I noticed that the listening socket only listens to request sent to the exact address that it''s bound to. Most applications respond to 127.0.0.1 as well as other any other interfaces with an ip address. Do they enumerate the available devices and create multiple sockets? or is there an option to tell it to listen to all ip adresses on a given port? Magmai Kai Holmlor "Oh, like you''ve never written buggy code" - Lee

Share this post


Link to post
Share on other sites
Palidine    1315
not sure what you mean but maybe this will help:

if you have a listen socket bound to port 80 of your own machine then it will "hear" the request made if someone makes a connection to <yourIpAddress> on port 80

it will also "hear" the request if you, from the server machine, make a request to <127.0.0.1> on port 80


obviously if you make a call from a remote machine to 127.0.0.1 on port 80 you will get no response, b/c 127.0.0.1 means "this machine", so the request will never get to your server.

-me

Edited by - Palidine on February 7, 2002 6:25:02 PM

Share this post


Link to post
Share on other sites
JonStelly    127
Check your SOCKADDR_IN structure. Make sure that you're setting your sin_addr field to INADDR_ANY. I'm guessing you're setting it to something else.

Edited by - JonStelly on February 7, 2002 6:29:11 PM

Share this post


Link to post
Share on other sites