I just wondering what java does when we call close on the inputStream and outStream associated with a socket. What is the difference from the close call on the socket, i.e Socket.close().
if we just close the io stream on the socket, but not close the socket, can we reopen the io stream on the socket again?
Thanks in advance!
You should close the outermost output stream you have created from the socket. That will flush it. Closing either the socket or the input stream doesn’t do that so it isn’t adequate. Having closed that output stream you don’t need to do anything else.