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!

Event-driven Socket Programming

807605Aug 29 2007 — edited Sep 1 2007
I've developed an application that communicates with a device over TCP/IP. Right now I have an infinite loop in another thread that continually checks for data on the socket, calling Thread.sleep() each time to prevent the receive thread from using the entire CPU, but I think this may be limiting my throughput. I'd like to either find a class that will generate an event for me when data arrives (which I'm doing myself at present), or be able to call wait() and have my thread notify()ed when data arrives on the socket. Can either of these things be done?
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Sep 29 2007
Added on Aug 29 2007
12 comments
351 views