关闭套接字不会抛出异常

时间:2011-05-18 10:18:53

标签: android multithreading sockets networking

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
  }
}

在Dell Streak上使用Android 2.2.2时,调用socket.shutdowninput()shutdownoutput()close()Thread.interrupt()都不会抛出异常,任何想法都是如此?

1 个答案:

答案 0 :(得分:0)

这是已知错误:http://code.google.com/p/android/issues/detail?id=7933

看看最后三条评论。