I have an application that uses simple sockets to pass some characters between two systems The application is to run as a server. I establish a connection properly, and pass a message too, however, after a message my connection has been closed.
I can tell this how it happens like shutting down the shutdown of printwriter
and bufferedReader
socket? This is bad because I have many messages to send to the same connection.
printWriter = new print witter (theServer.getClientSocket (.) GetOutputStream ()); BufferedReader = New BufferedReader (New InputStreamReader (theServer.getClientSocket). GetInputStream ())); PrintWriter.println ("Line"); PrintWriter.close (); // off on these lines? BufferedReader.close (); // off on these lines?
Will I complete it? How do I create this connection in Java?
Yes, any writer / reader shutting down will stop all the Writers and Readers that they wrap up Are there. Do not turn it off until you are ready to close the underlying socket.
Comments
Post a Comment