开发者

How to determine which server IP address the client connected to

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜