I'm programming with Winsock2. I have two network adapters in system, one for local connections (LAN), one for outer connections (PPPOE). When I perform a connect() call to connect to local address, it uses PPPOE adapter instead of LAN. I know I could tweak this using metrics, but can't I just use some hard-code to forcibly use LAN adapter? Thanks in advance!
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试):
问题:
回答1:
Before you connect(), you need to bind() to the IP address of the LAN adapter. Just specify the IP address, and leave the port open (i.e. 0), so that the system can still chose one.