Just downloaded the edtFTP .NET client 1.1.6 today. I am using VS.NET 2003 release on XP Pro with SP1. When I try to put a file, I get the following error: "A socket operation was attempted to an unreachable network."
When I try to connect and put the file from the FTP command line, all works fine.
Here is the code I am using. Note the remote file name has to be in single quotes because the remote server is a mainframe.
Thanks for your help.
private static void TestFTPSend()
{
FTPClient ftp = null;
try
{
Console.WriteLine( "Connecting..." );
ftp = new FTPClient( hostname );
ftp.CommandSent += new (FTPMessageHandlerClass1.ftp_CommandSent );
ftp.ReplyReceived += new FTPMessageHandler( Class1.ftp_ReplyReceived );
Console.WriteLine( "Logging in..." );
ftp.Login( username, password );
ftp.ConnectMode = FTPConnectMode.PASV;
ftp.TransferType = FTPTransferType.ASCII;
Console.WriteLine( "Sending file..." );
ftp.Put( "SFG1.dat", "'EPTA.OUTPUT(+1)'" );
Console.WriteLine( "Disconnecting..." );
ftp.Quit();
}
catch ( Exception ex )
{
Console.WriteLine( "Error: " + ex.Message );
if ( ftp != null ) ftp.Quit();
}
Console.ReadLine();
}