i writing client program in java. server written in c++. when sending message client server it's fine. during receiving client thread gets stuck in call
in = new bufferedreader(new inputstreamreader(socket.getinputstream()));
and when break connection received data gets printed. getting scenario getinputstream() not getting termination character(which don't know should be), in c it's null character. please tell me should append @ end of message @ server side recover form problem.
you should use:
in = new inputstreamreader(socket.getinputstream());
instead of:
in = new bufferedreader(new inputstreamreader(socket.getinputstream()));
bufferedreader
prepared use non-network io (such file io) , plain text lines ended newline character. if working network , binary data (and seems do) should use plain inputstreamreader
can use datainputstream
or similar make reading easier :)
Comments
Post a Comment