if (netType == 0) {
connStartTime = System.currentTimeMillis();
hc = (HttpConnection) Connector.open("http://" + ip + path);
hc.setRequestMethod(HttpConnection.GET);
try {
String contentType = hc.getHeaderField("Content-Type");
Debug.out.println("Content-Type=" + contentType);
if (contentType != null && contentType.indexOf("text/vnd.wap.wml") != -1) {
netType = 1;
}
} catch (Exception e) {
if (hc != null) {
hc.close();
hc = null;
}
hc = (HttpConnection) Connector.open("http://" + ip + path);
hc.setRequestMethod(HttpConnection.GET);
}
}
if (netType == 1) {
if (hc != null) {
hc.close();
hc = null;
}
connStartTime = System.currentTimeMillis();
hc = (HttpConnection) Connector.open("http://10.0.0.172" + path);
hc.setRequestProperty("X-Online-Host", ip);
hc.setRequestMethod(HttpConnection.GET);
}
http自适应接入点网络连接方式
最新推荐文章于 2021-07-30 07:46:54 发布