working FTP sample wanted

Last post 04-02-2008 10:52 by owenwk. 22 replies.
Page 1 of 2 (23 items) 1 2 Next >
Sort Posts: Previous Next
  • 03-03-2008 10:06

    working FTP sample wanted

    Please can somebody give me a working sample in Visual Studio C# on how to do FTP.

    I have tried to get the code out the vault to work without much joy - I dont follow what is being done.

    I want to be able to copy a file to an FTP server and copy a file from an FTP server.

     All help gratefully appreciated.

    Thanks In Advance

    Delene

  • 03-03-2008 10:39 In reply to

    • ctacke
    • OpenNETCF Staff
    • Top 10 Contributor
    • Joined on 07-27-2007
    • Indiana
    • Posts 1,940

    Re: working FTP sample wanted

    Take a look at our new shared-source library available here.

    Filed under:
  • 03-04-2008 7:45 In reply to

    Re: working FTP sample wanted

    I downloaded the file that you gave me but am unable to run it.

    When I try to load the project under Visual Studio 2005 I get the following error message

    "The project location is not trusted".  I then click on Ok

    I then get an error "Error retrieving information from user datastore.  Platform not found"

    The project does not load

    Any suggeations

  • 03-04-2008 7:52 In reply to

    • neil
    • OpenNETCF Staff
    • Top 10 Contributor
    • Joined on 07-30-2007
    • North Wales
    • Posts 1,153

    Re: working FTP sample wanted

    Please explain what you mean by "unable to run it" as that statement doesn't really give us any information. The less vague you are, the faster we can help.


  • 03-04-2008 8:12 In reply to

    Re: working FTP sample wanted

    Neil

    I downloaded the zip file and extracted into a folder on my c drive. The folder I chose was OpenNETCF.

    I then open Visual Studio 2005

    I choose File | Open | Project or Solution

    I select the folder OpenNETCF and choose the file OpenNETCF.NET.FTP

    I then get an error message that says that the program location is not trusted.  I click OK (which is saying to it ignore)

    It then comes up with an error "Error retrieving information from user datastore.  Platform not found"

    Hope this is enough detail - I am sure that I am doing something incorrect..

  • 03-04-2008 8:21 In reply to

    • neil
    • OpenNETCF Staff
    • Top 10 Contributor
    • Joined on 07-30-2007
    • North Wales
    • Posts 1,153

    Re: working FTP sample wanted

    The "platform not found" error tells me that you don't have a required SDK installed. You need to install the Windows Mobile 5.0 Pocket PC SDK in order to open and compile the sample.  


  • 03-04-2008 8:31 In reply to

    Re: working FTP sample wanted

    thanks neil I will download the SDK and try it again in the morning and let you know.
  • 03-05-2008 5:44 In reply to

    Re: working FTP sample wanted

    I downloaded the SDK as you said. The example there is for Windows Mobile 5 and I am using Windows CE but that isnt a problem.

    I have added the neccessary reference - openNETCF.NET.FTP

    and have the following code

    OnResponse("Connecting...");

    m_ftp = new FTP(server.text);

    m_ftp.ResponseReceived += new FTPResponseHandler(m_ftp_ResponseReceived); m_ftp.Connected += new FTPConnectedHandler(m_ftp_Connected);

    m_ftp.BeginConnect(username.text, password.text);

     FileStream stream = File.OpenRead("\\my documents\\StockTakeAndre\\darryl.txt");

    m_ftp.SendFile(stream, "collecttoday.txt");

    stream.Close();

     

    When I get to the point of m_ftp.SendFile(stream, " "); I get an error method only valid with an open connection...

    I assume that this means that my connection is not open or present..

    Please can you tell me what i am missing

     

    Thanks

     

  • 03-05-2008 7:06 In reply to

    Re: working FTP sample wanted

    I do not receive the response connected after doing the following code

    OnResponse("Connecting...");

    m_ftp = new FTP(server.text);

    m_ftp.ResponseReceived += new FTPResponseHandler(m_ftp_ResponseReceived);

    m_ftp.Connected += new FTPConnectedHandler(m_ftp_Connected);

    m_ftp.BeginConnect(username.text, password.text);

     

    Does any one have any suggestions as to why???

  • 03-05-2008 8:58 In reply to

    • ctacke
    • OpenNETCF Staff
    • Top 10 Contributor
    • Joined on 07-27-2007
    • Indiana
    • Posts 1,940

    Re: working FTP sample wanted

    BeginConnect is asynchronous, meaning that you won't be connected when the call returns.  You have to wait for the connection to be made befoe doing a transfer.  The reason for this is that some servers have a long timeout, and you app could hang for a long time if it were synchronous. 

    Filed under:
  • 03-05-2008 9:51 In reply to

    Re: working FTP sample wanted

    then the $64 000 - 00 question is how do I make a connection
  • 03-05-2008 10:17 In reply to

    • ctacke
    • OpenNETCF Staff
    • Top 10 Contributor
    • Joined on 07-27-2007
    • Indiana
    • Posts 1,940

    Re: working FTP sample wanted

    Look at the sample.  You call BeginConnect and then wait for the connection to complete before proceeding. 

  • 03-06-2008 5:14 In reply to

    Re: working FTP sample wanted

    i have waited over half an hour and it never connects...
  • 03-06-2008 6:57 In reply to

    Re: working FTP sample wanted

    I have been using the example.

    The problem is that the connection is never made.  Why I dont know. 

    How can I force it to connect or better still find out why it is not connecting?

    I can leave it for any time length of 5 minutes to 90 minutes and it still doesnt connect..

  • 03-06-2008 7:27 In reply to

    • neil
    • OpenNETCF Staff
    • Top 10 Contributor
    • Joined on 07-30-2007
    • North Wales
    • Posts 1,153

    Re: working FTP sample wanted

    How are you testing the sample: using an emulator or real device? Can you browse to a web site from your test unit? Does the test unit have an active network connection prior to attempting to connect to the FTP server?

    It is worth noting that calling BeginConnect assumes you have an active network connection before it attempts to connect to the FTP server.


Page 1 of 2 (23 items) 1 2 Next >