关闭套接字不抛出异常 [英] Closing socket does not throw exception

查看:159
本文介绍了关闭套接字不抛出异常的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

public void run() {
  try {
    ois = new ObjectInputStream(clientSocket.getInputStream());

    Object o;
    while ((o = ois.readObject()) != null) {
        //do something with object
    }
  } catch (Exception ex) {
    //Log exception
  }
}

调用 socket.shutdowninput() shutdownoutput()的close()了Thread.interrupt()上的所有戴尔Streak采用了Android 2.2.2时不要抛出异常,任何想法,为什么会是这样?

Calling socket.shutdowninput(), shutdownoutput(), close(), Thread.interrupt() all do not throw an exception when using Android 2.2.2 on the Dell Streak, any ideas why this is so?

推荐答案

这是已知的bug:的 HTTP:?//$c$c.google.com/p/android/issues/detail ID = 7933

This is known bug: http://code.google.com/p/android/issues/detail?id=7933.

看看最后的三点意见。

这篇关于关闭套接字不抛出异常的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆