当前页面: 开发资料首页 → J2ME 专题 → 联网的问题
联网的问题
摘要: 联网的问题
以下是我写的手机联网的程序:
try{
conn = (HttpConnection)Connector.open(url);
int code = conn.getResponseCode();
if(code != HttpConnection.HTTP_OK){
str = "error";
}
is = conn.openDataInputStream();
UTF8 utf = new UTF8();
String retStr;
retStr = utf.readUnicodeFileUTF8(is);
is.close();
conn.close();
str = retStr;
}catch(Exception ex){
str = ex.toString();
}
这段代码在nokia上可以正常地联到网上,但在moto L7上半天没反应,最后联接不上,这是为什么。
看看有没有异常,把它打到屏幕上在判断
Moto默认是走CMWAP的~~
nokia走cmwap可以连上,我做过,不过moto的不知为什么走cmwap不行,必须走cmnet