同一个socket的输入流和输出流是有关系的,只要关闭其中的一个流,另一流也会关闭。
socket关闭,其相关流同时关闭
官方文档:
Closes this socket.
Any thread currently blocked in an I/O operation upon this socket will throw a SocketException
.
Once a socket has been closed, it is not available for further networking use (i.e. can't be reconnected or rebound). A new socket needs to be created.
Closing this socket will also close the socket's InputStream
and OutputStream
不做翻译了,呵呵。