Hi all,
I am pretty much new to Java (I've had experience in C++) and have been working on a "simple" FTP client. I pretty much ended up with the code below. Problem is I get a lot of errors mostly related to the IOException in each method. The errors are "not a statement", "; expected", and "illegal start of expression". I've looked up the errors to find a resolution, but I haven't found anything concrete, so I've come here as a last resort. Appreciate the help. Thanks.
import java.net.*;
import java.io.*;
import java.lang.*;
import java.io.IOException;
import org.apache.commons.net.ftp.FTP;
import org.apache.commons.net.SocketClient;
import org.apache.commons.net.ftp.FTPClient;
public class UIAgent {
public static void main(String[] args) {
// Connect to FTP Server
public void connect(String hostname) throws SocketException, IOException
{
connect(hostname, _defaultPort_);
}
public int user(String username) throws IOException
{
return sendCommand(FTPCommand.USER, username);
}
public int pass(String password) throws IOException
{
return sendCommand(FTPCommand.PASS, password);
}
public int syst() throws IOException
{
return sendCommand(FTPCommand.SYST);
}
public int type(int fileType) throws IOException
{
return sendCommand(FTPCommand.TYPE,
__modes.substring(fileType, fileType + 1));
}
// Get file from the FTP Server
public int retr(String pathname) throws IOException
{
return sendCommand(FTPCommand.RETR, pathname);
}
// Quit the FTP Server
public int quit() throws IOException
{
return sendCommand(FTPCommand.QUIT);
}
}
}