Stop/Interrupt threads blocked on waiting input from socket

后端 未结 6 1835
自闭症患者
自闭症患者 2021-01-04 04:12

As the title says I need a way to stop or interrupt a thread that is blocked waiting on an input from the socket.

6条回答
  •  不知归路
    2021-01-04 04:41

    I didn't see socket.closeInput(). However, I did find socket.shutdownInput(). After calling that (from a different thread that was blocking on the read naturally), my call to bufferedReader.close() worked fine! (I followed that with calls to printWriter.close() and socket.close().

提交回复
热议问题