我试图运行简单的应用程序从Android模拟器访问互联网,这是我的代码.我支持代理并在模拟器中通过"...无线网络 - > APN - > ..."配置代理设置.但互联网是从浏览器而不是应用程序.
HttpURLConnection connection = null;
String URLName = "http://www.google.com";
try {
URL u = new URL(URLName);
connection = (HttpURLConnection) u.openConnection();
connection.setRequestMethod("HEAD");
int code = connection.getResponseCode();
Log.d(TAG1, " " + code);
// You can determine on HTTP return code received. 200 is success.
} catch (MalformedURLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
Log.d(TAG1, e.toString());
}
finally {
if (connection != null) { …Run Code Online (Sandbox Code Playgroud) 在我的Erlang应用程序中,我想使用外部库(erlzmq2).我是erlang的新手,不知道如何打包或编译它.目前我正在使用rebar进行编译,如果答案基于编辑rebar.config文件,那对我来说会更有用.