当前位置: 代码迷 >> J2ME >> symbian关闭http连接解决思路
  详细解决方案

symbian关闭http连接解决思路

热度:6216   发布时间:2013-02-25 21:36:47.0
symbian关闭http连接
用j2me在nokia6681上面作了个连接http连接的软件

但是当需要强制终止http连接时   软件就会自己跳出关闭

public   static   synchronized   void   stepConnection(){
                try{
                        is.close();
                        is=null;
                }catch(Exception   ex){}
               
                try{
                        conn.close();
                        conn=null;
                }catch(Exception   ex1){}              
        }

请问这几句写法有错误么   又不然怎么会直接over呢   我倒是看到了symbia   c++断开gprs时有直接跳出程序的例子

------解决方案--------------------------------------------------------
is 是什么?
InputStream么?
------解决方案--------------------------------------------------------
try{
is.close();

}catch(Exception ex){}
finally{

try{
is=null;
}
catch(Exception e){}

}


------解决方案--------------------------------------------------------
public static synchronized void stepConnection(){
try{
if(is!=null)is.close();
is=null;
}catch(Exception ex){}

try{
if(conn!=null)conn.close();
conn=null;
}catch(Exception ex1){}
编码要严紧
}

------解决方案--------------------------------------------------------
is是null就会出错!楼上正解~~
  相关解决方案