Skip to Main Content

Java Programming

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

How do I both read and write a socket?

807588Apr 1 2009 — edited Apr 1 2009
Hello,
So, I am working on a server - client system and I am having a problem figuring out how to do this.

-The client connects to the server, where a thread is created for the connection.
-An initial exchange of data happens.
-After exchange, the connection remains open so that login status and such is saved and associated with the connection.
-The connection sits idle until either the client or the server have something to say, and start a new exchange of data.

The problem that I am having is that both the client and server have to sit at a read to wait for the other to start a communication, but while waiting at read, the thread is blocked.

Thanks in advance for any advice.
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Apr 29 2009
Added on Apr 1 2009
15 comments
551 views