Java代码 Android 设置访问WebService的timeout (转) Android 设置访问WebService的timeout (转)Android 设置访问WebService的timeout (转)
  1. public void setConnectTimeOut(int timeout);  
public void setConnectTimeOut(int timeout);


然后在ServiceConnectionSE.java类中,实现setConnectTimeOut(int timeout)方法:
Java代码 Android 设置访问WebService的timeout (转) Android 设置访问WebService的timeout (转)Android 设置访问WebService的timeout (转)
  1. public void setConnectTimeOut(int timeout) {   
  2.     connection.setConnectTimeout(timeout);   
  3. }  
public void setConnectTimeOut(int timeout) {
    connection.setConnectTimeout(timeout);
}

实际上connection就是java.net.HttpURLConnection。

在HttpTransportSE类中新增了一个构造方法
Java代码 Android 设置访问WebService的timeout (转) Android 设置访问WebService的timeout (转)Android 设置访问WebService的timeout (转)
  1. public HttpTransportSE(String url, int timeout) throws IOException {   
  2.     super(url);   
  3.     connection = getServiceConnection();   
  4.     connection.setConnectTimeOut(timeout);   
  5. }  
public HttpTransportSE(String url, int timeout) throws IOException {
    super(url);
    connection = getServiceConnection();
    connection.setConnectTimeOut(timeout);
}

相关文章:

  • 2022-12-23
  • 2021-05-26
  • 2021-12-04
  • 2021-11-27
  • 2021-06-25
  • 2022-12-23
  • 2021-07-30
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-10-13
  • 2022-12-23
相关资源
相似解决方案