【问题标题】:cURL-Is there any way to force curl to use a specific net interfacecURL - 有什么办法可以强制 curl 使用特定的网络接口
【发布时间】:2017-03-25 08:27:39
【问题描述】:

如果我有不同的网络连接方式,如 wifi、我的 android 手机中的手机数据,有没有办法告诉 cURL 在连接到服务器时使用特定接口,而不使用任何其他接口(如果可用)。我只想使用 wifi 连接,不想使用手机数据。

【问题讨论】:

    标签: android c++ http curl libcurl


    【解决方案1】:

    使用 --interface 选项。从 curl 手册页:

    --接口

    使用指定的接口执行操作。你可以输入 接口名称、IP 地址或主机名。一个示例可能如下所示:

    curl --interface eth0:1 https://www.example.com/

    如果多次使用此选项,将使用最后一个。

    【讨论】:

    • 感谢 vielmetti,映射到 CURLOPT_INTERFACE。
    猜你喜欢
    • 2017-10-01
    • 2010-10-08
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2022-07-26
    • 2019-12-29
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多