Solved

Question about socket/Thread programming...

Posted on 2002-03-08
3
171 Views
Last Modified: 2010-03-31
Hi Guys,

  If a thread calls a blocking socket.read(...), is it possible for another thread to wake up the blocking thread, so socket.read(...) return immediately


(2nd question: Is there any non-blocking socket.read(...)?)
stephen
0
Comment
Question by:zollen
  • 2
3 Comments
 
LVL 92

Accepted Solution

by:
objects earned 100 total points
Comment Utility
Q1. Not that I'm aware of.

Q2. 1.4 added support for non-blocking I/O:
http://java.sun.com/j2se/1.4/docs/guide/nio/
There's also a 3rd party libraries:
http://www.purpletech.com/code.jsp
http://www.cs.berkeley.edu/~mdw/proj/java-nbio/
0
 
LVL 5

Expert Comment

by:nebeker
Comment Utility
As an alternative to a non-blocking read, you can call "available()" to see if any data is there, before you commit to calling read().
0
 
LVL 92

Expert Comment

by:objects
Comment Utility
0

Featured Post

Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

Join & Write a Comment

Suggested Solutions

For beginner Java programmers or at least those new to the Eclipse IDE, the following tutorial will show some (four) ways in which you can import your Java projects to your Eclipse workbench. Introduction While learning Java can be done with…
In this post we will learn how to connect and configure Android Device (Smartphone etc.) with Android Studio. After that we will run a simple Hello World Program.
Viewers learn about the “for” loop and how it works in Java. By comparing it to the while loop learned before, viewers can make the transition easily. You will learn about the formatting of the for loop as we write a program that prints even numbers…
Viewers will learn about if statements in Java and their use The if statement: The condition required to create an if statement: Variations of if statements: An example using if statements:

743 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now