IPEndPoint serverIPE = new IPEndPoint(IPAddress.Parse("server ip"), 80);
            IPEndPoint localIPE = new IPEndPoint(IPAddress.Parse("192.168.1.2"), 6639);
            Socket socket = new Socket(serverIPE.AddressFamily, SocketType.Stream, ProtocolType.Tcp);
            socket.Bind(localIPE);//就是这句了
            socket.Connect(serverIPE);

  其实就是开始连接前多Bind一下,C++下也有类似绑定。

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-07-04
  • 2022-12-23
  • 2021-11-12
  • 2021-08-14
猜你喜欢
  • 2022-12-23
  • 2021-11-17
  • 2021-06-25
  • 2021-11-09
  • 2021-11-09
  • 2022-12-23
  • 2021-04-21
相关资源
相似解决方案