开发者

Socket.bind to all ips - An invalid argument was supplied

I want to bind the socket t开发者_如何学Goo all the IP addresses available on the machine using:

  mainSocket.Bind(new IPEndPoint(IPAddress.Parse("0.0.0.0"), 0)); //or IPAddress.Any

but I get an An invalid argument was supplied on

 mainSocket.IOControl(IOControlCode.ReceiveAll, byTrue, byOut);

Instead, when I specify the IP, it works just fine.

Socket.bind to all ips - An invalid argument was supplied

Ok maybe that's impossible to achieve. But how about detecting which internet interface is being used to connect to internet and getting it's ip? (assuming user is behind NAT / router)


I think it's not possible. Operation with sockets has limitations according to this document TCP/IP Raw Sockets

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜