HP3000-L Archives

August 2002, Week 2

HP3000-L@RAVEN.UTC.EDU

Options: Use Monospaced Font
Show Text Part by Default
Show All Mail Headers

Message: [<< First] [< Prev] [Next >] [Last >>]
Topic: [<< First] [< Prev] [Next >] [Last >>]
Author: [<< First] [< Prev] [Next >] [Last >>]

Print Reply
Subject:
From:
Ernest Hill <[log in to unmask]>
Reply To:
Ernest Hill <[log in to unmask]>
Date:
Fri, 9 Aug 2002 10:30:04 -0500
Content-Type:
text/plain
Parts/Attachments:
text/plain (111 lines)
Here's what's happening. I have java program that try's to get the
InputStream from a URLConnection object. The connection was opened using a
URL for a valid host but with nothing listening on the port. Java should
throw a java.net.ConnectionException: Connection refused, and does, the
first time the getInputStream method is invoked on a 918 running 6.5 with
no patches installed. The second time  the getInputStream is invoked no
exception is thrown, you just exit from java which results in a Pipe broken
message if you are running java from the shell. On a 918 running 7.0 p6 the
same thing happens. On a 969 400 running 6.5 powerpatch 2 the exception is
never thrown you just exit from java.
Below I have included the source for a simple program demonstrating this
behavior. If you are wondering why are there 2 invocations of
getInputStream in the program this is to demonstrate the behavior.
Originally there was only one invocation.  We found that when you ran the
program and got the exception, if you immediately ran it again you would
not get the exception you would just exit from java. If you waited a while
before running it again you would get the exception.
Regards,
Ernest

p.s If you run this program on another platform the exception is always thrown.

===========================================
The Program
===========================================
import java.io.InputStream;
import java.net.Socket;

class stuff2 {
         static void main (String[] Args) throws Exception {
java.net.URLConnection uc = null;
                 InputStream y=null;
try {
java.net.URL u = new java.net.URL("http://madhatter.sonfire.com:8080");
                 uc = u.openConnection();
                 System.out.println("before getInputStream");
                 y = uc.getInputStream();
                 System.out.println("after getInputStream");
}catch(Exception e) {
e.printStackTrace();
}
                 System.out.println("before getInputStream");
                 System.out.flush();
                 y = uc.getInputStream();
                 System.out.println("before read");
                 System.out.flush();
                 System.out.println("I just read and got back : " + y.read());
                 System.out.println("after read");
                 y.close();
                 System.out.println("after close");
         }
}
==================================
Results of running on 918  6.5 no patches
==================================
java -cp . stuff2
before getInputStream
java.net.ConnectException: Connection refused
         at java.net.PlainSocketImpl.socketConnect(Native Method)
         at java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java:125)
         at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:112)
         at java.net.Socket.<init>(Socket.java:273)
         at java.net.Socket.<init>(Socket.java:100)
         at sun.net.NetworkClient.doConnect(NetworkClient.java:50)
         at sun.net.www.http.HttpClient.getDontProxy(Compiled Code)
         at sun.net.www.http.HttpClient.getDontProxy(Compiled Code)
         at sun.net.www.http.HttpClient.getDontProxy(Compiled Code)
         at sun.net.www.http.HttpClient.getDontProxy(Compiled Code)
         at sun.net.www.http.HttpClient.getDontProxy(Compiled Code)
         at
sun.net.www.protocol.http.HttpURLConnection.connect(HttpURLConnection
.java:379)
         at stuff2.main(stuff2.java:12)
before getInputStream
[1] + Done(141) java -cp . stuff2
   8716373       Pipe broken     java
=====================================
Results on 969 400 6.5 power patch 2
============================================
java -cp . stuff2
before 1 getInputStream
[1] + Done(141) java -cp . stuff2
   60489852      Pipe broken     java
========================================
Results on 918 7.0 P6
========================================
java -cp . stuff2
before getInputStream
java.net.ConnectException: Connection refused
         at java.net.PlainSocketImpl.socketConnect(Native Method)
         at java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java:125)
         at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:112)
         at java.net.Socket.<init>(Socket.java:273)
         at java.net.Socket.<init>(Socket.java:100)
         at sun.net.NetworkClient.doConnect(NetworkClient.java:50)
         at sun.net.www.http.HttpClient.getDontProxy(Compiled Code)
         at sun.net.www.http.HttpClient.getDontProxy(Compiled Code)
         at sun.net.www.http.HttpClient.getDontProxy(Compiled Code)
         at sun.net.www.http.HttpClient.getDontProxy(Compiled Code)
         at sun.net.www.http.HttpClient.getDontProxy(Compiled Code)
         at
sun.net.www.protocol.http.HttpURLConnection.connect(HttpURLConnection
.java:379)
         at stuff2.main(stuff2.java:12)
before getInputStream
[1] + Done(141) java -cp . stuff2
   131129        Pipe broken     java

* To join/leave the list, search archives, change list settings, *
* etc., please visit http://raven.utc.edu/archives/hp3000-l.html *

ATOM RSS1 RSS2