> my client side programme
>
[quoted text clipped - 25 lines]
> System.out.print((char) j);
> }
<snip>
> i am able to get only one input from keyboard and accordingly the
> response from server for that input.and then program is hanging
> up...when i remove the code for reading server response from the for
> loop(in client code) and keep out side the for loop i am getting
> output.what is the reason.please help me.
Your client loop to read the reply from the server is waiting for EOF. I
think you want to stop reading after \n instead. Hint: socket streams are
not packet-oriented at all. Also, DataInputStream.readLine() is
deprecated--look at switching to BufferedReader. Note also that if the user
enters an invalid number you program will still attempt to read a response
that will never come. Read reply should only be coupled with a successful
write--and you can use BufferedReader on the reply here also.
Cheers,
Matt Humphrey matth@ivizNOSPAM.com http://www.iviz.com/
thank you for your reply..can you suggest me any link for better
understainding of streams in java..
Matt Humphrey - 02 Mar 2006 13:46 GMT
> thank you for your reply..can you suggest me any link for better
> understainding of streams in java..
Try Roedy's pages on I/O. http://mindprod.com/jgloss/io.html They're not
stream-specific but it's a good starting place. And don't forget the Java
API. It may also seem that you should read some about TCP/IP because some
issues affect how you read data. http://mindprod.com/jgloss/tcpip.html
Cheers,
Matt Humphrey matth@ivizNOSPAM.com http://www.iviz.com/