You can only have a non blocking read if the stream you get can give you a SelectableChannel which the class you are using does not seem to provide. That was a point to point answer to your question However, if you tell us more about your problem i.e. why is it that you do not want to block the read or in which situation you do not want to block a read. We will be able to give you some alternatives, if possible.
Yes, I am using the org.apache.commons.net.telnet.TelnetClient however i need to use BufferedInputStream from java.io
Why i can't use the available() is because when I try to do a connection over ssl it falls over.
I want the option to use a telnet hand shake or a ssl hand shake
but when I call the available() method as i read back from the stream when using the ssl handshake (SSLSocket) it won't connect however when I use the telnet all is fine and of course the read doesn't BLOCK.
Thats why i can't use the available method as it breaks the SSLSocket connection. so was hoping if i could use read that won't block or some other way to get around this issue....
I switched on debug on the SSL connection System.setProperty( "javax.net.debug", "ssl");
and i got this in my output when i was calling the java.io.available() method EOF received that violates SSL protocol
[ December 11, 2008: Message edited by: terry Kiernan ] [ December 12, 2008: Message edited by: terry Kiernan ]