2

I have a TcpListener running on the local IP address but how do I get it to accept connections from all of the adapters? Because if I want to connect from the loopback(localhost) I can't.

Regards,
Jordan

Jordan LaPrise
  • 1,088
  • 1
  • 11
  • 20

2 Answers2

3

To listen on all adapters/interfaces you will want to listen on 0.0.0.0

Todd Hainsworth
  • 114
  • 1
  • 7
2

I think you're asking for IPAddress.Any to listen to all incoming connections or IPAddress.Loopback to listen to the loopback address. If you want to listen for connections from specific IP addresses, I believe you have to create one socket for each incoming IP address.

Edit: ... I may be misunderstanding your question. The following link might help you out:
TcpListener: How to listen on specific port on all interfaces?

Community
  • 1
  • 1
Warty
  • 7,237
  • 1
  • 31
  • 49
  • Just learned that "The Any field is equivalent to 0.0.0.0 in dotted-quad notation." according to http://msdn.microsoft.com/en-us/library/system.net.ipaddress.any.aspx – Warty Nov 01 '13 at 23:06