我有3个网络接口插头在我的pc (窗口)。我只是想知道是否有一种从特定接口发出http请求的简单方法?
我试着卷曲,但它似乎不支持窗户。
描述:https://curl.se/libcurl/c/CURLOPT_INTERFACE.html
Windows不支持在
上使用此选项的网络接口名称。
以下是我的网络详细信息:
Ethernet adapter NETW 001:
Connection-specific DNS Suffix . :
Link-local IPv6 Address . . . . . : fe80::8a7:9368:bb58:1883%18
IPv4 Address. . . . . . . . . . . : 192.168.5.252
Subnet Mask . . . . . . . . . . . : 255.255.255.0
Default Gateway . . . . . . . . . : 192.168.5.1
Ethernet adapter NETW 002:
Connection-specific DNS Suffix . :
Link-local IPv6 Address . . . . . : fe80::e4e0:bc83:3e56:8de0%13
IPv4 Address. . . . . . . . . . . : 192.168.78.252
Subnet Mask . . . . . . . . . . . : 255.255.255.0
Default Gateway . . . . . . . . . : 192.168.78.1
Ethernet adapter NETW 003:
Connection-specific DNS Suffix . :
Link-local IPv6 Address . . . . . : fe80::f0e7:c451:335:8587%12
IPv4 Address. . . . . . . . . . . : 192.168.1.252
Subnet Mask . . . . . . . . . . . : 255.255.255.0
Default Gateway . . . . . . . . . : 192.168.1.1发布于 2022-07-21 04:58:20
还不清楚是什么阻止您使用特定接口的IPv4地址。同一手册:
传递一个char *作为参数。这将设置要用作传出网络接口的接口名。名称可以是接口名称、、IP地址或主机名。如果参数以"host!“开头它被视为、IP地址、或主机名。
#if 1
curl_easy_setopt(curl, CURLOPT_INTERFACE, "192.168.78.252");
#else
curl_easy_setopt(curl, CURLOPT_INTERFACE, "host!192.168.78.252");
#endifhttps://stackoverflow.com/questions/73047201
复制相似问题