Answer the question
In order to leave comments, you need to log in
How to clean the incoming stream?
Hello everyone
Tell me, plz, how to clean the incoming stream?
there is such a code on the client (it sends data):
outputStream = new PrintWriter(serverConnect.getOutputStream(),true);
void sendToServer(String message) {
outputStream.println(message);
outputStream.flush();
String getValuefromClient() throws IOException {
clientInputStream = null;
clientInputStream = new BufferedReader(new InputStreamReader(clientConnect.getInputStream()));
String message = clientInputStream.readLine();
return message;
get.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent event) {
try {
String message = null;
message = server.getValuefromClient();
messages.setText(message);
} catch (Exception ex) {messages.setText("Problem");
ex.printStackTrace();}
}
});
clientInputStream = new BufferedReader(new InputStreamReader(clientConnect.getInputStream()));
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question