Hey.
I created a server-client pair that connect to each other through a TCP socket and they're supposed to be able to talk to each other....only they can't.
The server program just stops and does nothing whenever the server attempts to read from the socket data stream. Here's the relevent code:
PrintWriter out = new PrintWriter(ClientSocket.getOutputStream(), true);
String InData = "InDataInitString";
out.println("Handshake"); // <---- This goes through to client just fine
BufferedReader in = new BufferedReader(
new InputStreamReader(ClientSocket.getInputStream()));
try
{
InData = in.readLine(); // Error occurs here
System.out.println("Check");
System.out.println(InData);
}
catch(IllegalBlockingModeException e)
{
out.println("end");
System.err.println(e.getMessage());
System.exit(1);
}
The catch statements are never reached. the
in.readLine()
call just seems to take forever.
its obvious that the sockets are connected correctly, because i can send data from server to client just fine.
The client is deffinately sending data to the server...the server is just not reading it.
Any ideas? I'm kinda new at Java AND new at network programming, so any help would be great.
Thanks!
Matt