Java interrupt thread when reading socket [duplicate]
问题 This question already has answers here : Closed 8 years ago . Possible Duplicate: How to terminate a thread blocking on socket IO operation instantly? I have client run in thread want to read from socket in Java. But while reading, maybe I want to kill the thread. So I interrupt it, but does socket's reading methods throw InterruptedException ? I didn't find. So, how can I nicely ask thread to die while it's blocking on reading socket? Thanks 回答1: It has been answered How to terminate a