Our Products:   CompleteFTP  edtFTPnet/Free  edtFTPnet/PRO  edtFTPj/Free  edtFTPj/PRO
0 votes
4.2k views
in Java FTP by (160 points)
I have a European user having FTP errors. Could this be a proxied server? I'm only using the free FTPj which doesn't support proxies (and cannot yet afford FTPj/PRO which does). I can access his site from here without a problem. Here is a "cleansed" log of a portion of the session:

[FTP] Response '250 OK. Current directory is XXX' received from 'XXX.se'
[FTP] Request 'PWD' sent to 'XXX.se'
[FTP] Response '257 "XXX" is your current location' received from 'XXX.se'
[FTP] Request 'SIZE XXX.jpg' sent to 'XXX.se'
[FTP] Error '550 Can't check for file existence' occurred on 'ftp://XXX.se/XXX'
[FTP] Request 'MDTM XXX.jpg' sent to 'XXX.se'
[FTP] Error '550 Can't check for file existence' occurred on 'ftp://XXX.se/XXX'
[FTP] Request 'PORT 0,0,0,0,204,204' sent to 'XXX.se'
[FTP] Error '501 Syntax error in IP address' occurred on 'ftp://XXX.se/XXX'
[FTP] Request 'QUIT' sent to 'XXX.se'


Notice the 501 error after the PORT command. Any ideas?

I just looked at the source code and see this sequence of commands is coming from FTPClient.exists(); the SIZE and MDTM commands both fail so FTPj is trying to do a RETR for which it does a PORT command. I don't know why the IP address of the local host shows as zeros, though. Funny thing is that when I contact this same server from here in the US, the SIZE command works fine. I guess this is why I am suspecting some proxy mechanism is involved...

3 Answers

0 votes
by (162k points)
The 0.0.0.0 is causing the 501 error.

The 550 errors for SIZE are being returned by the FTP server - I suppose it could be a proxy that is being used, but it is hard to tell.

An alternative to exists() is to use dir() or dirDetails().

PS edtFTPj does have some proxy support, see the Javadoc.
0 votes
by (160 points)
I realize the 0.0.0.0 is causing the 501 error but that is being generated by edtFTPj, not any of my code. Basically, inside FTPClient.exists(), it tries SIZE then MDTM then RETR and there is a PORT command sent before the RETR which is where the 0.0.0.0 is coming from.

I don't understand how the PORT command is getting 0.0.0.0 as it just gets the local address from the control socket. So it must be getting back 0.0.0.0 as the local address of the control socket. How can that be?

This is the latest edtFTPj just downloaded yesterday as I originally had this problem with 1.5.5 so I checked for any updates and found 1.5.6 so I tried it but with the same result...
0 votes
by (162k points)
Your control socket is returning 0.0.0.0 when socket.getLocalAddress() is called on it, which is the "any" address.

I'm yet to figure out why a bound socket is doing this.

Try dirDetails() as a workaround.

Categories

...