Cannot connect socket through socks proxy

Discussion in 'Java' started by Barney, May 31, 2005.

  1. Barney

    Barney Guest

    Hi,

    I'm having problems using the Apache Commons FTPClient to connect to an
    external FTP site through a firewall:

    System.setProperty("socksProxyHost", proxyUrl);
    System.setProperty("socksProxyPort", proxyPort);

    FTPClient ftp = new FTPClient();
    try {
    ftp.connect(url);
    ...

    When I run this, the whole thing just hangs. However, using a
    standalong FTP client (SmartFTP) configured with the same settings
    works fine.

    Using Ethereal, I had a look at the network traffic. The SmartFTP
    session connects directly using SOCKS4, whereas the java session first
    tries SOCKS5 and then falls back to SOCKS4. This all looks fine. This
    level of detail is all getting a bit beyond me, but the problem appears
    to be in the SOCKS connection packet being sent.

    Successful connection:

    Frame 4 (63 bytes on wire, 63 bytes captured)
    Ethernet II, Src: 00:0d:56:c5:6c:27, Dst: 00:00:5e:00:01:02
    Internet Protocol, Src Addr: <local.ip.address>, Dst Addr:
    <proxy.ip.address>
    Transmission Control Protocol, Src Port: 4313 (4313), Dst Port: 1080
    (1080), Seq: 1, Ack: 1, Len: 9
    Socks Protocol
    Version: 4
    Command: 1 (Connect)
    Remote Port: 21
    Remote Address: <external.ftp.server>
    User Name:

    Unsuccessful connection:

    Frame 4 (55 bytes on wire, 55 bytes captured)
    Ethernet II, Src: 00:0d:56:c5:6c:27, Dst: 00:00:5e:00:01:02
    Internet Protocol, <local.ip.address>, Dst Addr: <proxy.ip.address>
    Transmission Control Protocol, Src Port: 4600 (4600), Dst Port: 1080
    (1080), Seq: 1, Ack: 1, Len: 1
    Socks Protocol
    Version: 5
    [Unreassembled Packet (incorrect TCP checksum): Socks]

    Of course, this could all just be an Ethereal problem.

    Either way, does anyone have any idea what is going wrong here, and how
    I can fix it?

    Running on Windows XP Pro
    java version "1.4.2_06"
    Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.2_06-b03)
    Java HotSpot(TM) Client VM (build 1.4.2_06-b03, mixed mode)

    Thanks,

    Barney
    Barney, May 31, 2005
    #1
    1. Advertising

  2. Barney

    jainjani

    Joined:
    Jul 25, 2006
    Messages:
    1
    Even i am facing the same problem is anybody has answer to this.....
    jainjani, Jul 25, 2006
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Kevin

    Socks proxy library

    Kevin, Dec 13, 2003, in forum: Java
    Replies:
    0
    Views:
    820
    Kevin
    Dec 13, 2003
  2. Chorg
    Replies:
    1
    Views:
    1,446
    A Baba
    Dec 13, 2003
  3. vidy5300
    Replies:
    0
    Views:
    860
    vidy5300
    Jun 7, 2004
  4. SOCKS proxy in Python?

    , Nov 2, 2005, in forum: Python
    Replies:
    0
    Views:
    982
  5. Ju Hui
    Replies:
    4
    Views:
    1,811
    Ju Hui
    Apr 13, 2006
Loading...

Share This Page