J
Jani Yusef
I am attempting to send data to a client socket and then turn around
and read the response back from the client. The data is sent but when
I attempt to read the data sent back it hangs. I have checked and the
client is receiving the data just fine and seemingly sending back a
perfectly correct reponse. Is there an error in the code below which
is preventing me from reading the data sent back to me correctly?
Any advice would be much appreciated.
//servo is an instance of ServerSocket and socko is an instance of
Socket
//send the message to attached clients
Socket s=servo.accept();
PrintStream ps=new PrintStream(s.getOutputStream());
ps.println(response);
//Now read the response from the clients
s=servo.accept();//read input from clients
br=new BufferedReader(new InputStreamReader(s.getInputStream()));
response=br.readLine();//STUCK HERE, THE NEXT LINE IS NOT REACHED
and read the response back from the client. The data is sent but when
I attempt to read the data sent back it hangs. I have checked and the
client is receiving the data just fine and seemingly sending back a
perfectly correct reponse. Is there an error in the code below which
is preventing me from reading the data sent back to me correctly?
Any advice would be much appreciated.
//servo is an instance of ServerSocket and socko is an instance of
Socket
//send the message to attached clients
Socket s=servo.accept();
PrintStream ps=new PrintStream(s.getOutputStream());
ps.println(response);
//Now read the response from the clients
s=servo.accept();//read input from clients
br=new BufferedReader(new InputStreamReader(s.getInputStream()));
response=br.readLine();//STUCK HERE, THE NEXT LINE IS NOT REACHED