Posted By:
Jason_Heirtzler
Posted On:
Monday, June 24, 2002 05:12 PM
Hi - I'm having a networking problem that only occurs on the Mac (IE/PC, NS/PC, NS/Sun all are okay.) The background: MRJ 2.2.5, IE 5.0, Mac OS 9.0.4 My applet is sending data to a CGI, but, using a packet sniffer, it's clear only the HTTP headers go over the net. If I send smaller amounts of data (maybe <400k?) it gets sent fine. Here's a distilled version of what I am doing (I'm coping the following code by hand now..) URLConnection cnx; URL url; // already initialized /* XXX use ONLY ONE of the following lines! XXX */ cnx = new sun.net.www.protocol.http.HttpU
More>>
Hi -
I'm having a networking problem that only occurs
on the Mac (IE/PC, NS/PC, NS/Sun all are okay.)
The background: MRJ 2.2.5, IE 5.0, Mac OS 9.0.4
My applet is sending data to a CGI, but, using a
packet sniffer, it's clear only the HTTP headers
go over the net. If I send smaller amounts of
data (maybe
<400k?) it gets sent fine.
Here's a distilled version of what I am doing
(I'm coping the following code by hand now..)
URLConnection cnx;
URL url; // already initialized
/* XXX use ONLY ONE of the following lines! XXX */
cnx = new sun.net.www.protocol.http.HttpURLConnection(url, host, port);
//cnx = url.openConnection();
cnx.setDoInput(true);
cnx.setDoOutput(true);
cnx.setUseCaches(false);
cnx.setAllowUserInteraction(false);
cnx.setRequestProperty("Content-type", "application/x-binary");
ostream = cnx.getOutputStream();
.. write data to ostream ..
ostream.flush();
ostream.close();
// data never goes out, so we hang here
istream = cnx.getInputStream();
Regarding the 2 lines marked with XXX:
If I create an HttpURLConnection, as suggested here
http://developer.apple.com/qa/java/java26.html
Sending more than a few 100k causes the data to not
go over the net. Smaller amounts work fine.
If I use url.openConnection(), I have the same problem
but usually not until I call this code a second time.
<<Less