指定与 C# 中的 TCPClient / Socket 一起使用的传出 IP 地址
我的服务器有多个分配给网络适配器的 IP 地址。
该服务器上有一个客户端应用程序,用于通过 TCPClient 连接到另一个服务器应用程序。对于所有传出通信,我的服务器都使用默认 IP 地址,但是对于这个应用程序,我希望传出通信在另一个本地 IP 地址上发送。
通信时是否可以指定另一个本地分配的IP?
我正在尝试让远程服务器应用程序认为它来自另一个IP,因此它将通过防火墙等......
提前致谢
I've a server with several IP Addresses assigned to the network adapter.
On that server is a client app to connect to another server app via TCPClient. For all outgoing communications my servers default IP address is being used, however for this one application I'd like the outgoing communication to be send out on another local IP address.
Is it possible when communicating out to specify another locally assigned IP?
I'm trying to make the remote server app think it's from another IP so it will pass through firewalls etc....
Thanks in advance
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以使用接受本地终结点地址的
TcpClient
构造函数:例如:
参考:TcpClient 构造函数 (IPEndPoint)
You can use the constructor of
TcpClient
that accepts a local endpoint address:For example:
Reference: TcpClient Constructor (IPEndPoint)