开发者

How to determine which server IP address the client connected to

开发者 https://www.devze.com 2023-03-18 04:19 出处:网络
I\'m binding with IPAddress.Any.My server has multiple IP addresses.In my case all on the same NIC but I don\'t think that matters -- it could be just as easily multiple NIC.

I'm binding with IPAddress.Any. My server has multiple IP addresses. In my case all on the same NIC but I don't think that matters -- it could be just as easily multiple NIC.

I need to know which IP address the client has connected to. Is this possible, or should I create different sockets for each of my Ipaddresses and bind to each one?

开发者_如何学C

Update: Creating a TcpListener for each of the IP Addresses as proven to be the easiest solution, although I remain open to other suggestions related to IPAddress.Any (0.0.0.0)


TcpClient.Client.LocalEndPoint should contain the correct IP Address.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号