In Java API,
Socket socket = serverSocket.accept();
BufferedReader fromSocket = new BufferedReader(new InputStreamReader(socket.getInputStream()));
PrintWr
Yes, closing the input stream closes the socket. You need to use the shutdownInput method on socket, to close just the input stream:
//do sth with fromSocket ... and close it
socket.shutdownInput();
Then, you can still send to the output socket
//then write to socket again
toSocket.print("is socket connection still available?\r\n");
//close socket
socket.close();