开发者

C# Discover the LocalEndPoint AddressFamily port number

开发者 https://www.devze.com 2022-12-12 01:55 出处:网络
When I establish a tcp connection to a server using the TcpClient class, is there any way to find out t开发者_JAVA百科he source port of this connection?

When I establish a tcp connection to a server using the TcpClient class, is there any way to find out t开发者_JAVA百科he source port of this connection? I am trying to implement the exec protocol and stderr port seems to always be source port + 1.


Use ((IPEndPoint) tcpClient.Client.LocalEndPoint).Port after establishing the connection.


Solved :)

Client sends TCP port number (decimal ascii, null-terminated) of stderr port. If the first byte is a NULL, then server won't make any stderr connection.

0

精彩评论

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