TcpListener: Listen on every address, including GPRS IP address

前端 未结 1 1976
一个人的身影
一个人的身影 2021-02-13 09:23

We have a simple piece of legacy software with which we need to communicate using TCP/IP over port 15001. We need to listen on port 15001 for the legacy software to make a conne

相关标签:
1条回答
  • 2021-02-13 09:57

    You need to specify the IP address on which you want to listen, instead of IPAddress.Any. See here. When you use IPAddress.Any, it will automatically choose the network interface for you. To listen on a certain interface (in your case, GPRS) you have to use the correct IP in the constructor.

    This post has more information on getting the IP address for each nic.

    Also, if you're looking to listen on every IP address at once, you'll need a TcpListener for each nic.

    0 讨论(0)
提交回复
热议问题