Hi,
I am trying to make a really basic server that echoes whatever it receives from the client connected to it. Catch being the client is written in c++. The client sends an initiating packet to the server, which I am trying to echo to output.
I am using BufferedReader to read the incoming data from the socket. The problem is that even if I read each char, I cannot read the last char of incoming stream until the client disconnects.
When I use BufferedReader.readLine(), the server won't print anything until the client disconnects and then it prints the whole packet.
When I use BufferedReader.read(), to read single bytes and print them onto screen, all the bytes save the last get written to output. The last byte gets written when client disconnects.
I have been searching for a solution to this for quiet some time now.
The server code otherwise is fine, because if I telnet to the same port, the server echos perfectly.
In the past I have used a simple server written in C to echo everything from the same client.
I am not sure where the problem is, and any help or pointers would be highly appreciated.
-Q