Hi, I have 2 important classes(client and server) and I will write something in my text area and by clicking on the send button I will call the active method of the client class and I will send that text to my client class,every thing is ok and that text also will be printed on the server console but I can not echo that text from server to client,please help me thanks.
client class:( a part of that)
os = new PrintWriter(c.getOutputStream(), true);
is = new BufferedReader(new InputStreamReader(c.getInputStream()));
public static void active() {
String teXt = MainClient.getText();
os.println(teXt);
String line = is.readLine();
System.out.println("Text received: " + line);
os.flush();
is.close();
is.close();
c.close();
server class:( a part of that)
BufferedReader streamIn = new BufferedReader(new InputStreamReader(client.getInputStream()));
PrintWriter streamOut =new PrintWriter(client.getOutputStream());
boolean done = false;
String line =null;
while (!done ) {
line = streamIn.readLine();
if (line.equalsIgnoreCase("bye")) {
done = true;
} else {
System.out.println(line);
streamOut.println(line);
}
}
streamIn.close();
client.close();
server.close();