PDA

View Full Version : Fxping not working?


TheWhite
01-07-2010, 01:49 AM
import com.jscape.inet.ftp.Ftp;
import com.jscape.inet.ftp.FtpException;
import com.jscape.inet.ftp.Fxp;


public class test {

public static void main(String[] args) throws FtpException, InterruptedException {
Ftp source = new Ftp(host, user, pass, port);
source.connect();
source.makeDirRecursive("/blah/folder/");
source.setDir("/blah/folder/");
String listing = source.getDirListingAsString();
System.out.println(listing); //works

Ftp dest = new Ftp(host2, user2, pass2, port2);
dest.connect();
dest.makeDirRecursive("/blah/foo/folder/");
dest.setDir("/blah/foo/folder/");
listing = dest.getDirListingAsString();
System.out.println(listing); //works

Fxp fxp = new Fxp();
fxp.transferDir(source, dest, "."); //see notes below on what happens

}
}



source spams this over and over and over again very fast:
PWD
257 "/blah/folder/" is current directory.
CWD .
250 Directory changed to /blah/folder/
PWD
257 "/blah/folder/" is current directory.
PASV
227 Entering Passive Mode (##,###,##,##,###,2 changing numbers)
LIST
150 Opening ASCII mode data connection for /bin/ls.
226 Transfer complete.


dest spams this over and over and over again very fast:
PWD
257 "/blah/foo/folder/" is current directory.
MKD .
550 /blah/foo/folder/: Failed to create.
CWD .
250 Directory changed to /blah/foo/folder/
PWD
257 "/blah/foo/folder/" is current directory.


Whats going on here? Both servers are Serv-U v6.4. Actually, its the same server and same account. I was testing the FXP so I can clearly see the results for each.

mjawwad
01-07-2010, 03:46 AM
"source spams this over and over and over again very fast.
dest spams this over and over and over again very fast"

What do you mean by this?

I can see the following line on the dest debug output :

550 /blah/foo/folder/: Failed to create.

550 is an ftp error code, was this location actually created?

In addition I can see this line of code :

fxp.transferDir(source, dest, ".");

Is "." a valid directory?

Lastly use code in the following format :

try
{
// use code here
}
catch (Exception e)
{
System.out.println(e.getMessage());
e.printStackTrace();
}

Provide any stack-trace from your code.

TheWhite
01-07-2010, 07:39 AM
That's the thing, its just spamming that group of commands over and over again so my serv-u logs fill up quick. It never gets to fxping.

As for the question about the directory already existing, it tries to create and fails if its already there which is no problem as it still goes through.

"." should mean the current directory (I manually changed to the target directory first on both ftps). I've tried writing the full directory out, but it made no difference.

Is the source code available for any of these functions? They aren't really well documented or commented.......
I will debug/step through next time I get a chance.

mjawwad
01-07-2010, 07:44 PM
Source code is only available if you purchase the Enterprise License for the API, therefore I cannot print this in a forum. Try to catch the exception generated by using try-catch blocks, in addition use setDebug(true) before the connect() calls on the two Ftp instances this might reveal useful information.