Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

SOCKS v4 with an applet

0 views
Skip to first unread message

John Brayton

unread,
Apr 3, 2007, 2:58:18 PM4/3/07
to
I have a signed applet that needs to make HTTP requests back to the
web server. This works well with a direct connection. However, going
through a SOCKS 4 server, I can't seem to make any connection at all.
I've narrowed this down to a very simple call to:

new Socket(myIpAddress, myPortNumber)

I get this exception:

java.net.SocketException: Connection reset
at java.net.SocketInputStream.read(Unknown Source)
at java.net.SocksSocketImpl.readSocksReply(Unknown Source)
at java.net.SocksSocketImpl.connect(Unknown Source)
at java.net.Socket.connect(Unknown Source)
at java.net.Socket.connect(Unknown Source)
at java.net.Socket.<init>(Unknown Source)

This happens with IE configured to use the SOCKS server, regardless of
whether I add any code to attempt to use the SOCKS server. In my test
case the server is available directly to the applet, so it seems that
the JVM is trying to use the SOCKS server.

I'm using Java 1.5.0_11 under Win XP.

Any advice or suggestions would be appreciated.

John

John Brayton

unread,
Apr 3, 2007, 6:37:24 PM4/3/07
to
Replying to my own earlier message:

Packet-sniffing the transaction, I can see that IE's own requests are
being made through SOCKS v5. However, the applet requests are being
made through SOCKS v4. Is there a way to force a SOCKS request to be
a SOCKS v4 request?

John

hiwa

unread,
Apr 3, 2007, 11:30:58 PM4/3/07
to

What is your socksProxyHost system property
setting?

John Brayton

unread,
Apr 4, 2007, 10:03:54 AM4/4/07
to
Regardless of whether or not I call System.setProperty with the
"socksProxyHost" and "socksProxyPort" values, the symptoms are the
same. If I don't call System.setProperty(...) with those system
property values, then calling System.getProperty(...) for those
property values returns null for both "socksProxyHost" and
"socksProxyPort".

Some additional info:

* Packet-sniffing with Ethereal shows that IE is making Socks v4
connections; the applet is trying to make Socks v5 connections.

* Perusing JVM code, the "java.net.SocksSocketImpl" class has a setV4
method, but nothing in the JVM ever calls it. Since this works with
Socks v5 servers, but not Socks v4 servers, I suspect this is the
problem.

* The logical thing to do would be to simply call that setV4()
method. But a class has to be within the "java.net" namespace in
order to do so; the method is not public. And trying to creating my
own "java.net.*" class results in a SecurityException, even from a
PrivilegedAction.run() method. I don't believe you can have
"endorsed" classes from within the applet.

Thanks.

John

Andrew Thompson

unread,
Apr 4, 2007, 10:30:12 AM4/4/07
to
John Brayton wrote:
(applet)
>This happens with IE ..

.
>Any advice or suggestions would be appreciated.

Suggest trying Web Start to launch your applet.
<http://www.physci.org/jws/#jtest>

HTH

--
Andrew Thompson
http://www.athompson.info/andrew/

Message posted via JavaKB.com
http://www.javakb.com/Uwe/Forums.aspx/java-setup/200704/1

0 new messages