FTP upload not possible with ActiveSync 3.7.1?

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance

From: Roberto Rocco (roberto.rocco_at_atoll.biz)
Date: 08/17/04


Date: Tue, 17 Aug 2004 10:24:15 +0200

Hello,

uploading files to a FTP server always fails when I try to do it using an
active ActiveSync connection.

The very same code works perfectly instead when the FTP upload is done via
WLAN or a Modem.

The connection to the server is working properly, only the attempts to
upload files using FtpPutFile() fails when using ActiveSync.
The call to FtpPutFile() never returns, and all you can see on the FTP
server is that a file of the length 0 bytes is created.

What's wrong?? Why is FTP uload not working through ActiveSync?

I'm using ActiveSync Version 3.7.1 on a Windows XP machine and try to
connect using Pocket PC 2003 "T-Mobile MDA II" and several other Windows
CE.NET 4.2 devices.
All are showing the same behaviour.

Is that a known bug?
Below you can find a snippet of our code:

Many thanks in advance for every hint.

Best regards,

Roberto Rocco.

......

private void button1_Click(object sender, System.EventArgs e)
{
    IntPtr hInternet = IntPtr.Zero;
    IntPtr hConnection = IntPtr.Zero;
    try
    {
        hInternet = InternetOpen(@"FTPClient",
        INTERNET_OPEN_TYPE_DIRECT,
        null,
        null,
        0);

        if(hInternet == IntPtr.Zero)
       {
            MessageBox.Show ("Error in InternetOpen()!", "FTP Error",
MessageBoxButtons.OK, MessageBoxIcon.Exclamation,
MessageBoxDefaultButton.Button1);
            return;
        }

        hConnection = InternetConnect(
            hInternet,
            "Hostname",
            INTERNET_DEFAULT_FTP_PORT,
            "Username",
            "Password",
            INTERNET_SERVICE_FTP,
            0,
            0);

        if(hConnection == IntPtr.Zero)
        {
             MessageBox.Show ("Error in InternetConnect()!", "FTP Error",
MessageBoxButtons.OK, MessageBoxIcon.Exclamation,
MessageBoxDefaultButton.Button1);
             return;
        }

        bool bRet = FtpPutFile (
            hConnection, @"\Program Files\FtpTestWinInet\Test.txt",
            "Test.txt",
            FTP_TRANSFER_TYPE_BINARY,
            0);

        if(bRet == false)
        {
            MessageBox.Show ("Error in FtpPutFile()!", "FTP Error",
MessageBoxButtons.OK, MessageBoxIcon.Exclamation,
MessageBoxDefaultButton.Button1);
            return;
        }

        MessageBox.Show("FTP Upload successful");
    }
    catch (Exception ex)
    {
        MessageBox.Show ("Unhandled error occured!", "FTP Error",
MessageBoxButtons.OK, MessageBoxIcon.Exclamation,
MessageBoxDefaultButton.Button1);
    }
    finally
    {
        if (hConnection != IntPtr.Zero)
        {
            bool ret = InternetCloseHandle(hConnection);
            if(ret == false)
            {
                MessageBox.Show ("Closing the FTP connection failed", "FTP
Error", MessageBoxButtons.OK, MessageBoxIcon.Exclamation,
MessageBoxDefaultButton.Button1);
            }
        }
        if (hInternet != IntPtr.Zero)
        {
            bool ret = InternetCloseHandle(hInternet);
            if(ret == false)
            {
                UInt32 ErrorNumber = (UInt32)Marshal.GetLastWin32Error();
                MessageBox.Show ("Closing the Internet connection failed!",
"FTP Error", MessageBoxButtons.OK, MessageBoxIcon.Exclamation,
MessageBoxDefaultButton.Button1);
            }
        }
    }
}



Relevant Pages

  • Ftp over activesync
    ... now the problem could come from activesync 4.5 and windows ce 5.0 or it's ... computer and retrives some files from the FTP server. ...
    (microsoft.public.windowsce.app.development)
  • Re: activesync 4.5 - windows ce 5.0 ftp probem
    ... The FTP and HTTP server are on the same machine. ... anyway the problem it's tricky because with activesync 4.5 using a pocket pc ... Windows CE device via ActiveSync, just not the machine to which it's ...
    (microsoft.public.windowsce.app.development)
  • No FTP Upload possible with FtpPutFile() through ActiveSync 3.7.1 ???
    ... do it using an active ActiveSync connection on a Pocket PC 2003 or Windows ... The very same code works perfectly instead when the FTP upload is done via ... The connection to the server is working properly, ... upload files using FtpPutFile() fails when using ActiveSync. ...
    (microsoft.public.pocketpc.developer.networking)
  • No FTP Upload possible with FtpPutFile() through ActiveSync 3.7.1 ???
    ... do it using an active ActiveSync connection on a Pocket PC 2003 or Windows ... The very same code works perfectly instead when the FTP upload is done via ... The connection to the server is working properly, ... upload files using FtpPutFile() fails when using ActiveSync. ...
    (microsoft.public.pocketpc.developer)
  • RE: Uploading files via telnet instead of FTP to a RH 8 server?
    ... I want to do it that way because my existing FTP server is down due to ... way to re upload a fresh RPM of my FTP RPM instead of doing it on site. ... Uploading files via telnet instead of FTP to a RH 8 server? ...
    (RedHat)