如何从 Java 应用程序在网络之间切换? [英] How to switch between networks from a Java application?
问题描述
是否可以使用 java 以编程方式从一个 Wi-Fi 网络断开连接并连接到另一个网络?
Is it possible to disconnect from one wi-fi network and connect to another network programatically using java?
我的 Java 应用程序使用 twitter4j 向 twitter 发出请求.我每小时只能从特定 IP 地址发出 350 个请求.现在我在继续我的请求之前睡了一个小时.但我有两个 Wi-Fi 网络要连接.
My java application makes request to twitter using twitter4j. I can make only 350 requests per hour from a particular IP address. Now I'm sleeping for an hour before continuing my requests. But I have two Wi-Fi networks to connect to.
因此,当超出限制并且出现异常时,如果我可以在网络之间切换,我可以将完成的工作量增加一倍.在java中可以吗?
So when the limit exceeds and I get an exception, if I can switch between the networks, I can double the amount of work done. Is it possible in java?
推荐答案
只有在 java 中才有可能,因为 java 可以调用原生代码.您需要使用 C 或 C++ 中的本机代码来实现这一点.
It's only possible in java because java can call native code. You would need to implement this with native code in C or C++.
这篇关于如何从 Java 应用程序在网络之间切换?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!