This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Sockets and Internet Protocols and the fly likes Blocking read call Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Sockets and Internet Protocols
Bookmark "Blocking read call" Watch "Blocking read call" New topic
Author

Blocking read call

bharath sina
Greenhorn

Joined: Dec 20, 2009
Posts: 8
Hi,

I have this problem regarding socket programming. I have a server listening on 4 ports and a client connected to them. I have separate threads for each channel/port on both client and server. But I am facing a problem with blocking read call.What if I need to write to the socket while it is blocked on a read? Should I create another thread for the writing (which means I have to worry about deadlock/race conditions, right?) or can I somehow interrupt the thread, abort the blocked read command and write instead?
 
Don't get me started about those stupid light bulbs.
 
subject: Blocking read call
 
Similar Threads
networking and threading!
networking and threading!
Non-blocking sockets
Runnable state
socket read-write-read-write-...