Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Set read timeout less than 1 millisecond?  RSS feed

Warren Dew
Ranch Hand
Posts: 1332
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The Socket class allows me to set a timeout for the input stream so that I can check the stream for input and not block for too long. However, this timeout has to be set to 1 millisecond or longer - setSoTimeout(0) is interpreted as setting an infinite timeout.

I'm writing a real time application where 1 ms is a significant amount of time, and I'd like to be able to block for less than that (preferably just long enough to check whether there's any data). I was hoping that the new 1.4 SocketChannel class would let me do this, but it's apparently an abstract class and I'd have to write my own implementation.

Is there a way to do what I want, or am I stuck?
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!