This week's giveaway is in the Spring forum.
We're giving away four copies of REST with Spring (video course) and have Eugen Paraschiv on-line!
See this thread for details.
The moose likes Sockets and Internet Protocols and the fly likes Server/Client Socket Connection Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of REST with Spring (video course) this week in the Spring forum!
JavaRanch » Java Forums » Java » Sockets and Internet Protocols
Bookmark "Server/Client Socket Connection" Watch "Server/Client Socket Connection" New topic

Server/Client Socket Connection

Accela Moon

Joined: Apr 11, 2004
Posts: 20
Hi, I am trying to program a simple server/client socket connection program, the main function is to send and receive objects between them. I somehow went wrong and the connection between them keeps terminating right after establishing connection. Is there anything I can do to resolve this?
This is gonnna be kinda long post.. sorry. These are the code that starts and ends the socket connection. I'm kinda desperate for this to work.. so thanks in advance.

mira yang
Ranch Hand

Joined: Nov 08, 2003
Posts: 33
I got the same problem. And i post a topic in Java � I/O and Streams
If you get a answer,please send a copy to me
mira yang
Ranch Hand

Joined: Nov 08, 2003
Posts: 33
Hello, I have got a answer to solve this problem:
The best way to create a dead lock is to try to read from both ends of a stream at the same time. I assume that the code for your server and your client are both attempting to get the ObjectInputStream before getting the ObjectOutputStream. Basically, all you have to do to fix this problem is put the getObjectOutputStream line BEFORE the getObjectInputStream line..
Hope this helps!
I agree. Here's the link:
subject: Server/Client Socket Connection
jQuery in Action, 3rd edition