all groups > iis ftp > january 2008 >
You're in the

iis ftp

group:

FTP on Windows Mobile


FTP on Windows Mobile ElCarso
1/4/2008 10:20:04 AM
iis ftp:
Hi,

is anybody able to help me with a question concerning FTP on mobile units?

I have implemented FTP handling in an application aimed for both the Windows
and the Windows Mobile platforms.
While connecting and moving files from a PC (Windows XP) to a server
(Windows Server 2003) everything goes fine.
But, when the same code runs on a Pocket PC, the application hangs for a
while on the write operation 'FtpPutFile(...)', and then regains control and
displays an error message.
I've tried this both on Pocket PC 2002 and Windows Mobile 5 with the same
result.

Below exactly what happens:
- FTP connection: OK
- File creation: OK
- Data transfer: no data uploaded.
The file is created on server side but its size is zero bytes.
The error returned from the 'GetLastError()' call is 183, which means
"Cannot create a file when that file already exists.".
But this makes no sense, because there was no such file on server side when
the applciation started, and exactly the same procedure works fine when
executed on a PC.

On server side the FTP log looks as follows, where the first block is from
the successful PC upload, while the second one is from the unsuccessful
Pocket PC upload:

12:04:56 213.201.63.80 [180]USER Administrator 331 0
12:04:56 213.201.63.80 [180]PASS - 230 0
12:04:56 213.201.63.80 [180]CWD / 250 0
12:04:56 213.201.63.80 [180]MKD /temp/testfolder 550 183
12:04:56 213.201.63.80 [180]MKD /temp 550 183
12:04:56 213.201.63.80 [180]MKD /temp/testfolder 550 183
12:04:56 213.201.63.80 [180]created /temp/testfolder/temp.txt 226 0
12:04:56 213.201.63.80 [180]DELE /temp/testfolder/temp.txt 250 0

12:07:38 213.201.63.80 [181]USER Administrator 331 0
12:07:38 213.201.63.80 [181]PASS - 230 0
12:07:38 213.201.63.80 [181]CWD / 250 0
12:07:38 213.201.63.80 [181]MKD /temp/testfolder 550 183
12:07:38 213.201.63.80 [181]MKD /temp 550 183
12:07:38 213.201.63.80 [181]MKD /temp/testfolder 550 183
12:07:59 213.201.63.80 [181]created /temp/testfolder/temp.txt 425 10060

The only differences I can see are the two numbers at the end of the
'created' line, which are '250 0' in the first case, when it goes OK, and
'425 10060' in the second case, when it fails.

Does anybody know what those numbers are, what they represent?
Is this relevant for my problem?
Does anybody know what the cause of the problem may be.

I would be VERY grateful for any suggestion that can put me on the right
track.
Thanks in advance.

Re: FTP on Windows Mobile ElCarso
1/7/2008 1:20:00 AM
PROBLEM SOLVED!!

Thanks Bernard.

Solution: Apparently the flag INTERNET_FLAG_PASSIVE must be set in the
InternetConnect() call (see below) when FTP is requested from a mobile unit
through ActiveSync.
I did no know that, NOW I KNOW (after 3 days spent working on this issue!).

-------------------
InternetConnect( RootHandle, Site, INTERNET_DEFAULT_FTP_PORT, Account,
Password, INTERNET_SERVICE_FTP, INTERNET_FLAG_PASSIVE, NULL );
-------------------

A very happy ElCarso :)

[quoted text, click to view]
Re: FTP on Windows Mobile Bernard Cheah [MVP]
1/7/2008 11:13:07 AM
Ya. it sux when the same code doesn't work at different device :)

425 - Cannot open data connection.
10060 - A connection attempt failed because the connected party did not
properly respond after a period of time, or established connection failed
because connected host has failed to respond.

could be networking connection :) but tcpip communication should be same for
Windows mobile.

can you try a simple test code that just upload ?
without making those folders already exist ?

--
Regards,
Bernard Cheah
http://www.iis.net/
http://msmvps.com/blogs/bernard/


[quoted text, click to view]

Re: FTP on Windows Mobile JRancier@penntraffic.com
1/8/2008 8:31:12 AM
[quoted text, click to view]

Are you using an FTP package on WM? Or are you writing the raw socket
code yourself? In the future you may want to take a look at using
Wireshark to take a trace. http://www.wireshark.org/

Jeff

Re: FTP on Windows Mobile Bernard Cheah [MVP]
1/9/2008 1:15:39 PM
LOL Awesome...

--
Regards,
Bernard Cheah
http://www.iis.net/
http://msmvps.com/blogs/bernard/


[quoted text, click to view]

AddThis Social Bookmark Button