Hi,
I'm having a little problem with some sockets. I'm creating client and server sockets to talk to each other, however my serversude socket is never receiving data.
// client
socket = new Socket(IP_ADDRESS, PORT_NUMBER);
out = new BufferedWriter(new OutputStreamWriter(socket.getOutputStream()));
in = new BufferedReader(new InputStreamReader(socket.getInputStream()));
out.write("BIDDER:" + name);
out.newLine();
// server
socket = serverSocket.accept();
in = new BufferedReader(new InputStreamReader(socket.getInputStream()));
..
..
try {
if(!in.ready()) {
System.out.println("in not ready " + i);
continue;
}
message = in.readLine();
}
catch(IOException ioe) {
...
}
After the client sends the data to the server, a new
thread is created with the code above in. However, in.ready() always returns false. I think this may be because there is no data in the stream, but can't figure out why.
There are no exceptions thrown, so the connections are being made.
Any ideas?
Thanks,
Richard