I have a java application that communicates with a server via a servlet.
For the most part, it works like a champ (ISP's netzero, @home, cable
and wireless, businesses like IBM, International Paper). However, when
I use it with certain ISP's and businesses (AT&T Worldnet Service, Charles
Schwab), it fails opening an input connection to the applet.
Here is the applet code. I have stripped out some null error checking,
exception handling, and other stuff for the sake of keeping it small.
The first routine writes to the servlet and the second routine reads
from the servlet. Note that the write always works. It is the
URLConnection.getInputStream() call that fails:
private cvtInputStream inStream; // extends FilterInputStream
private cvtOutputStream outStream; // extends FilterOutputStream
private URLConnection connection;
public void connectAndSendHeader()
{
try
{
URL servl = new URL("http://mycomputer/servlet/myservlet");
connection = servl.openConnection();
// inform the connection that we will send output and accept input
connection.setDoInput(true);
connection.setDoOutput(true);
// Don't use a cached version of URL connection.
connection.setUseCaches (false);
connection.setDefaultUseCaches (false);
// Specify the content type that we will send binary data
connection.setRequestProperty ("Content-Type",
"application/octet-stream");
outStream = new cvtOutputStream(connection.getOutputStream());
// Write stuff to servlet here using outStream. This all works fine.
....
}
catch (Exception e)
{
;
}
}
// This is the routine that reads data from the servlet.
// It fails with a "FileNotFound" exception from certain ISP's.
//
public int getResponse()
{
try
{
inStream = new cvtInputStream(connection.getInputStream());
// FileNotFound Exception thrown here
return inStream.getInt();
}
catch (IOException err)
{
System.out.println(err);
}
}
Anyone know what is going on? I am really having trouble figuring
out why it works on some ISP's/businesses and fails on others.
Thanks.
-- Gary
___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".
Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html