I have tried to use the FTP facility. One very small mistake I have noticed in the FTP.cs, in GetFile routine,
(!File.exists(LocalName))
must be changed to :
(File.exists(LocalName))
I have written a very basic code to download a file from the Server to the Device. My code is :
FTP myFTP = new FTP();
myFTP.Port=21;
myFTP.RemoteHost="HostDirectory.net";
myFTP.Connect("UserID","pwd");
bool ServerConnected = false;
myFTP.ConnectionTimeout=10000;
while (!ServerConnected)
{
if (myFTP.IsConnected)
{
ServerConnected=true;
}
Thread.Sleep(1000);
}
if (ServerConnected)
{
myFTP.RemoteDirectory="\\SubDirectoryTemp";
myFTP.TransferType= FTPTransferType.Binary;
try
{
myFTP.GetFile("test.asp","AA.asp",true);
myFTP.Disconnect();
return "Success";
}
catch(Exception e)
{
myFTP.Disconnect();
return "GetFile Failure : " + e.ToString(); }
}
else
{
return "Failure : Timed Out";
}
Out of every 50 times I run this code I may just get one successfull session.
I must be doing something very wrong. Could you please advise me on this.
One other thing to do with OpenNETCF.Net but not with FTP, is that I use the ConnectionManager to establish GPRS connection. I get a GPRS connection, however when I manually look at the state of the GPRS by touching the antena symbol with stylus, the state of GPRS says Connect GPRS, instead of saying connected. For some reason the system has not registered the state of GPRS after connecting with ConnectionManager. Do I need to somehow register the state of the GPRS after programmatically establishing one, similar to registering the GSM after turning it ON.
Thank you
highflyer