TcpListener binding to multiple IP addresses (not 0.0.0.0)

cjard

Well-known member
Joined
Apr 25, 2006
Messages
7,081
Programming Experience
10+
Quick Q:

This machine has TEN (10) IP addresses. I want to listen on port 12345 of FIVE out of the ten only. Can TcpListener bind to 5 out of the 10, or do I create 5 listeners, one for each IP?

So far I think the latter because I only found reference to creating a TcpListener with one IP/port argument.. THe IP may be 0.0.0.0 which listens on all interfaces in the machine, but I don't want that at this time.
 
You can only bind a TcpListener (Socket) to one IPEndPoint (ip+port), so you need multiple listeners.
 
Back
Top