如何在Windows中将套接字绑定到设备? [英] How bind socket to device in windows?
问题描述
我在计算机中有相同的网卡.所有卡具有相同的IP.我需要将套接字绑定到特定的卡.在Linux中,我可以使用标志SO_BINDTODEVICE.我如何在Windows中做到这一点.
I have same network cards in computer. All cards has identical IP. I need to bind socket to specific card. In linux I can use flag SO_BINDTODEVICE. How I can do this in windows.
P.S.UDP套接字需要此.
P.S. This needed for UDP sockets.
推荐答案
I answered a similar question here: Using a specific network interface for a socket in windows
AFIK:在Windows XP和Windows Server 2003 IP4中,我相信您不能,但是对于IP6,您可以.对于Windows Vista和Windows 2008,您可以(某些情况除外).
AFIK: in Windows XP and Windows Server 2003 IP4 I believe you can't, but for IP6 you can. And for Windows Vista and Windows 2008 you can (except for certain circumstances).
希望有帮助
这篇关于如何在Windows中将套接字绑定到设备?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!