For the purposes of constructing a rate limiter I need to be able to distinguish different users being routed through the same gateway. So if I have 100 clients with the same IP address I would like to tell them apart by what port they are associated with on the remote gateway/host/router.
I can get the IP easily with:
string clientIPAddress = ((IPEndPoint)tcpClient.Client.RemoteEndPoint).Address.ToString();
Is there some way similarly to get the remote port number for the client? Thanks.
var port = ((IPEndPoint)tcpClient.Client.RemoteEndPoint).Port
Ref.: http://msdn.microsoft.com/en-us/library/system.net.ipendpoint.port.aspx
HTH.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With