android - cURL-有没有办法强制 curl 使用特定的网络接口(interface)

标签 android c++ http curl libcurl

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

最佳答案

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

--interface

Perform an operation using a specified interface. You can enter interface name, IP address or host name. An example could look like:

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

If this option is used several times, the last one will be used.

关于android - cURL-有没有办法强制 curl 使用特定的网络接口(interface),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40542363/

相关文章:

c++ - 如何优化这种简单的数据(事件)类型转换类?

http - 为单元测试模拟用户浏览 session

android - Google Cloud Messaging 是否可以从 Android 通知中心删除消息?

android - monodroid .so 文件可以通过 .NET 代码进行管理吗?

android - 应用程序字体大小不变

c++ - 为什么编译器不允许 std::string 在 union 内?

c++ - 通过 Winsocks 发送一个 int 数组

android - 使用 FFmpeg4Android 从图像创建视频

c# - 通过 RestSharp 发送非多部分数据

node.js - 保护我的 HTTP 连接