wood burning stoves
The moose likes Beginning Java and the fly likes FTP Client Problem Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "FTP Client Problem" Watch "FTP Client Problem" New topic

FTP Client Problem

Peter Phung
Ranch Hand

Joined: Dec 06, 2001
Posts: 138
I'm writing a FTPClient application, but i keep getting this exception:
at sun.net.TransferProtocolClient.sendServer(TransferProtocolClient.java:99)
at sun.net.ftp.FtpClient.issueCommand(FtpClient.java:160)
at sun.net.ftp.FtpClient.openDataConnection(FtpClient.java:218)
at sun.net.ftp.FtpClient.get(FtpClient.java:315)
at archivetool.FTPClientDialog.getFile(FTPClientDialog.java:579)
at archivetool.FTPClientDialog.access$100(FTPClientDialog.java:22)
at archivetool.FTPClientDialog$3.run(FTPClientDialog.java:202)
the strange thing about this is that the application stops running at line 579, as can be seen above, which is in the middle of a method which performs the same get operation twice. The application performs the operation correctly the first time but not the second time.
Here's my code:

Please can someone help me with this

Pete<br />"Reality is an illusion <br />brought on by a lack of <br />drink, drugs and smut"
Mark Herschberg

Joined: Dec 04, 2000
Posts: 6037
I didn't go through the code thoroughly, but I have two comments.
First, you're referencing an external object, client. It may make sense, but it also means something could be happening outside the method which is effecting it.
Second, consider using the Linlyn code, http://www.cs.uwplatt.edu/classes/se273/comm/ftpcomm.html If you use this, be warned, the basic code creates a byte array, and when the array gets filled, it creates a new one, twice the size, and copies thje contents from one to another. In this way, it's very inefficient. If you have any knowledge about the size of the data, you can make it much more efficent with only a few minutes of work.
Peter Phung
Ranch Hand

Joined: Dec 06, 2001
Posts: 138
Unfortunately my work requires me to use only packages and classes released by sun.
I've posted all of the methods which use client below :

I've spent ages going over the code but i cant find the problem.
Please can someone help
Peter Phung
Ranch Hand

Joined: Dec 06, 2001
Posts: 138
Any help would be apreciated
I agree. Here's the link: http://aspose.com/file-tools
subject: FTP Client Problem
It's not a secret anymore!