Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. having problem to translate from WinForm to Windows-CE C# program - FTP transfer [modified]

having problem to translate from WinForm to Windows-CE C# program - FTP transfer [modified]

Scheduled Pinned Locked Moved C#
csharpsysadminhelpquestion
2 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • G Offline
    G Offline
    Gali1978
    wrote on last edited by
    #1

    having problem to translate from WinForm to Windows-CE C# program - FTP transfer i have this code for transfer from Local computer to FTP server its work excellent on WinForm, i must have this on Windows-CE and it dosnt work the code:

    string MyFile = @"d:\PC.sdf";

            string url = "ftp://127.0.0.1/PC.sdf";
            FtpWebRequest request = (FtpWebRequest)FtpWebRequest.Create(url);
    
            request.Method = WebRequestMethods.Ftp.UploadFile;
            //request.Credentials = new NetworkCredential("user name", "password");
            request.UsePassive = true;
            request.UseBinary = true;
            request.KeepAlive = false;
    
            //byte\[\] buffer = File.ReadAllBytes(MyFile);
    
            using (Stream reqStream = request.GetRequestStream())
            {
                int count = 0;
                byte\[\] buffer = new byte\[100\];
                using (FileStream file = new FileStream(MyFile, FileMode.Open))
                {
                    while ((count = file.Read(buffer, 0, 100)) > 0)
                    {
                        reqStream.Write(buffer, 0, count);
                    }
                }
    
            }
    

    in WinCE there isnt FtpWebRequest or FtpWebRequest i think that i need to use OpenNetCF ???? can i get any C# sample code for this ?

    modified on Friday, August 12, 2011 6:08 AM

    OriginalGriffO 1 Reply Last reply
    0
    • G Gali1978

      having problem to translate from WinForm to Windows-CE C# program - FTP transfer i have this code for transfer from Local computer to FTP server its work excellent on WinForm, i must have this on Windows-CE and it dosnt work the code:

      string MyFile = @"d:\PC.sdf";

              string url = "ftp://127.0.0.1/PC.sdf";
              FtpWebRequest request = (FtpWebRequest)FtpWebRequest.Create(url);
      
              request.Method = WebRequestMethods.Ftp.UploadFile;
              //request.Credentials = new NetworkCredential("user name", "password");
              request.UsePassive = true;
              request.UseBinary = true;
              request.KeepAlive = false;
      
              //byte\[\] buffer = File.ReadAllBytes(MyFile);
      
              using (Stream reqStream = request.GetRequestStream())
              {
                  int count = 0;
                  byte\[\] buffer = new byte\[100\];
                  using (FileStream file = new FileStream(MyFile, FileMode.Open))
                  {
                      while ((count = file.Read(buffer, 0, 100)) > 0)
                      {
                          reqStream.Write(buffer, 0, count);
                      }
                  }
      
              }
      

      in WinCE there isnt FtpWebRequest or FtpWebRequest i think that i need to use OpenNetCF ???? can i get any C# sample code for this ?

      modified on Friday, August 12, 2011 6:08 AM

      OriginalGriffO Offline
      OriginalGriffO Offline
      OriginalGriff
      wrote on last edited by
      #2

      Firstly, always use the code block widget when posting code samples - it preserves the formatting and makes it easier to read. (you can edit your question and add it) Secondly, "it dosnt work" isn't particularly helpful - what does it do that you didn't expect, or not do that you did? Was there an error message?

      Real men don't use instructions. They are only the manufacturers opinion on how to put the thing together. Manfred R. Bihy: "Looks as if OP is learning resistant."

      "I have no idea what I did, but I'm taking full credit for it." - ThisOldTony
      "Common sense is so rare these days, it should be classified as a super power" - Random T-shirt

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups