Win a copy of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js this week in the JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Server client Application  RSS feed

 
Florin Duban
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
my client opens the connection to the server and then blocks on opening the input stream ?
Can anyone tell me what could be the problem?
thanks
 
Michael Morris
Ranch Hand
Posts: 3451
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Florin,
Welcome to JavaRanch. The client will block until the server flushes the output stream unless you are using the new nio package. Check that you are flushing the stream on the server after writing to it. You might want to post your code so we can take a look at it, be sure to use the code button and place your code between the tags.
 
Florin Duban
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
the problem is more like this
At the begining when I open the comunication between the client and server it blokcs
How can it be possible.
the code is like this:

And this blocks after writing
opening reader
If anyone can give me a clue.
then something else happened:
We were probing a new modem for a laptop that connects via a Mobile telephone card. Maybe I'm not using the right words here.
Anyway the problem is:
Even if the server is down the client opens the Socket corectly then tries to open the input stream and blocks. How can it be possible?
Thanks
 
Bert Heymans
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I could be mistaking but shouldn't you create an OutputStream and InputStream for each clientsocket connecting to the server. Depends on what your purpose is, but when making a multiclient parrallel server I make a ServerSocketInThread and ServerSocketOutThread. Inside the Thread classes I take IO streams from each clientsocket connecting. Like this:

I should add this isn't really what you would call real-life code, it's something I based on an exercise in my java-course. That's also why java.util.Vector is still used
[ August 31, 2003: Message edited by: Bert Heymans ]
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!