File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Sockets and Internet Protocols and the fly likes Java networking problem Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Sockets and Internet Protocols
Bookmark "Java networking problem" Watch "Java networking problem" New topic
Author

Java networking problem

Kasem Boonmun
Greenhorn

Joined: Dec 14, 2003
Posts: 4
I'm learning Java networking(IBM class). As a beginner, my code is compile and run smoothly except it displays one only one message on console even though I try re-send the message again and again. Would you please to help me out? Do I miss a thing?
Thanks in advance
Kasem

[ January 04, 2004: Message edited by: Kasem Boonmun ]
Michael Morris
Ranch Hand

Joined: Jan 30, 2002
Posts: 3451
The most likely cause is that you need to flush and close the BufferedReader at the end of your while loop. This sort of program works better when you start a separate thread for each request but that is probably beyond the scope of your study right now.


Any intelligent fool can make things bigger, more complex, and more violent. It takes a touch of genius - and a lot of courage - to move in the opposite direction. - Ernst F. Schumacher
Dirk Schreckmann
Sheriff

Joined: Dec 10, 2001
Posts: 7023
What does your client look like?


[How To Ask Good Questions] [JavaRanch FAQ Wiki] [JavaRanch Radio]
Dirk Schreckmann
Sheriff

Joined: Dec 10, 2001
Posts: 7023
Moving this to the Sockets and Internet Protocols forum...
David Weitzman
Ranch Hand

Joined: Jul 27, 2001
Posts: 1365
If you want the server to echo more than just a single line, you'll have to replace

with a loop that reads in lines and prints them until readLine() returns null. It's also a good idea to close the stream/socket when you're done with it, as Michael mentioned.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Java networking problem