🎉 Celebrating 25 Years of GameDev.net! 🎉

Not many can claim 25 years on the Internet! Join us in celebrating this milestone. Learn more about our history, and thank you for being a part of our community!

bind/listen/127.0.0.1

Started by
3 comments, last by Shannon Barber 22 years, 5 months ago
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
- The trade-off between price and quality does not exist in Japan. Rather, the idea that high quality brings on cost reduction is widely accepted.-- Tajima & Matsubara
Advertisement
Well, when I wrote my server I just had it listen on port 6000 and anyone could connect to it via my IP or i could connect to myself using 127.0.0.1 If that''s what you''re doing then I don''t know what''s wrong =)
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
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
Sure am, thanks!
- The trade-off between price and quality does not exist in Japan. Rather, the idea that high quality brings on cost reduction is widely accepted.-- Tajima & Matsubara

This topic is closed to new replies.

Advertisement