I need to append a stream of data to a remote dataset via the FTP append command.
Doing this in DOS works fine as shown below:
ftp> open XXXX
Connected to XXXX
220-FTPD1 IBM FTP CS V1R7 at XXXX, 07:10:01 on 2008-03-07.
220 Connection will close if idle for more than 5 minutes.
User (sto1.ica.se:(none)): XXXX
331 Send password please.
Password: XXXX
230 USER is logged on. Working directory is "XXXX.".
ftp> appe
Local file ftpmainframe.txt
Remote file 'XXXX.XXXX.XXX.XXXXXX.XXXX'
200 Port request OK.
125 Appending to data set XXXX.XXXX.XXX.XXXXXX.XXXX
250 Transfer completed successfully.
ftp: 18972 bytes sent in 0,00Seconds 18972000,00Kbytes/sec.
I wonder how I accomplish the same thing with xceed ftp library. The C# code below results in an error:
.
.
XceedFtp clientObj = new XceedFtpClass();
clientObj.ServerAddress = "XXXX";
clientObj.ServerPort = "21";
clientObj.UserName = "XXXX";
clientObj.Password = "XXXX";
clientObj.RepresentationType = EXFRepresentationType.frtASCII;
clientObj.PassiveMode = false;
clientObj.AllocateStorage = false;
clientObj.Connect(); // Connect works fine
.
.
private void SendBuffer(XceedFtp clientObj, byte[] buffer)
{
try
{
.
.
object vaData = buffer;
clientObj.SendMemoryFileData(ref vaData, endOfData); // results in the exception
// The data connection could not be established
.
.
}
catch (COMException exception)
{
// The data connection could not be established
}
}
I can see that a thread (Append to dataset) has been posted by Mikael in regards to this manner before but unfortunately no useful answers.
Any help is greatly appreciated!
Regards,
Ershad