How to listen on more than one address in .Net Socket?

0 votes
asked Jul 29, 2010 by dagang

I need the socket listen on all the addresses pointing my machine, i.e. loop back 127.0.0.1, local address 10.86.xxx.xxx. Is it possible?

3 Answers

0 votes
answered Jul 29, 2010 by leppie

You could try use IPAddress.Any.

0 votes
answered Jul 29, 2010 by richard

When you bind the socket, if you do not specify an address, it will listen on all. (And monitoring tools will show it listening on 0.0.0.0 (IPv4) or ::0 (IPv6).)

I.e. you need to specify an address to listen on that address, but not specifying an address will listen on all.

0 votes
answered Jul 29, 2010 by siddiqui

You need to set up a system-level hook for TCP/IP events.

Having hooked those events, you have to figure out the contents of the packets you get.

I found some introductory info on hooking Windows events here.

Welcome to Q&A, where you can ask questions and receive answers from other members of the community.
Website Online Counter

...