Einzelnen Beitrag anzeigen

Revolt

Registriert seit: 18. Okt 2004
1 Beiträge
 
#6

Re: 127.0.0.1(localhost) = current ip?

  Alt 18. Okt 2004, 23:22
Your Delphi TServerSocket component probably binds to INADDR_ANY, and thus listens on all available interfaces. This would make it APPEAR you're able to connect to localhost and others are able to connect to your IP, but in reality if you bound strictly to '127.0.0.1', people would not be able to make a connection to your computer from over the Internet.

struct sockaddr_in addr;

addr.sin_addr.s_addr = INADDR_ANY; // bind to all interfaces

as opposed to

addr.sin_addr.s_addr = inet_addr("127.0.0.1"); // bind to 127.0.0.1

or

addr.sin_addr.s_addr = inet_addr("69.29.23.12"); // bind to that IP (provided it's assigned to your computer) and now people can connect on it
  Mit Zitat antworten Zitat