.Net Socket 多网卡下指定网卡/绑定网卡发送数据

            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++下也有类似绑定。

转载于:https://www.cnblogs.com/zzmsl/archive/2012/10/22/2734344.html

你可能感兴趣的:(.Net Socket 多网卡下指定网卡/绑定网卡发送数据)