C# 发现 LocalEndPoint AddressFamily 端口号
当我使用 TcpClient 类与服务器建立 tcp 连接时,有什么方法可以找出此连接的源端口? 我正在尝试实现 exec 协议,而 stderr 端口似乎始终是源端口 + 1。
When I establish a tcp connection to a server using the TcpClient class, is there any way to find out the source port of this connection?
I am trying to implement the exec protocol and stderr port seems to always be source port + 1.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
建立连接后使用
((IPEndPoint) tcpClient.Client.LocalEndPoint).Port
。Use
((IPEndPoint) tcpClient.Client.LocalEndPoint).Port
after establishing the connection.解决了:)
Solved :)