[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[iaik-ssl] ready() on BufferedReader


I'm trying to understand a problem I'm seeing since I installed the 
latest and greatest JDK (version 1.3 with the security fix).  I did not 
see this problem with the JDK 1.2.2.

Calls to ready() on a BufferedReader stream always return true and then 
blocking on a read().  My understanding of this method is that it 
returns true if data is ready to be read.

A snippet of the code affected:

       try {
           ssl = null;
           DBMService service = serviceList.getDBMService(serviceName);
           context = new SSLClientContext();
           trustDecider = new I2A2TrustDecider(service);
           ssl = new SSLSocket(service.host, service.port, context);
           ssl.setSoTimeout(60000);        // Set a one minute timeout
           os = new PrintWriter(ssl.getOutputStream());
           is = new BufferedReader(new 
           greeting = is.readLine();
           // If the connection welcomed us, we've made a successful link
           isActive = (greeting.startsWith(SERVERGREETING));
           // Toss any trash that might be sent after we've got a connection
           while (is.ready()) {
                   trash = is.readLine();        // **** Code is 
blocking here ******

etc ...

The code is catching an InterruptedIOException at the statement:

trash = is.readLine();

due to a timeout.  Note that the code sets a 1 minute limit on reads set 
on the input side of the socket.

What am I doing incorrectly?  Has anybody seen this problem?

William I. Bormann
PACE Technical Consultant
Purdue University

Phone:  (765) 496-3186

Mailinglist-archive at http://jcewww.iaik.at/mailarchive/iaik-ssl/sslthreads.html

To unsubscribe send an email to listserv@iaik.at with the folowing content: UNSUBSCRIBE iaik-ssl