1.4. Transferring files between the iPAQ and the GNU/Linux host

As is, PocketPC has only one tool that uses the standard TCP/IP protocols able to transfer files: it is the Internet Explorer Web browser. Although its usage is straightforward, it has two drawbacks:

  1. it requires a running Web server on the GNU/Linux host

  2. it is only able to transfer file in one direction (from the GNU/Linux host to the iPAQ)

That is, it does not fulfill our requirements: to be able to exchange files in both directions.

The workaround I have found is to use it initially to download a minimum FTP server on the PocketPC iPAQ, which will be used for all subsequent transfers.

1.4.1. Downloading and running the mini FTP server

As we will use a Web browser on the iPAQ, we need first to set up a Web server on the GNU/Linux host, place the mini FTP server so it can be accessed from the iPAQ, then download it and install it.

1.4.1.1. Setting up a Web server on the GNU/Linux host

Giving all the details required to set up a Web server on a GNU/Linux host is beyond the scope of this guide. Maybe you already have done it for another task, or your GNU/Linux distribution has already done it for you.

So, I will only describe what is required to set up the Apache Web server. I will assume that you already have installed the required package for it, using your distribution's packaging tool.

We first have to locate the Apache configuration file, by running the following command:

bash# find etc -name httpd.conf -print
/etc/httpd/conf/httpd.conf

This tells us that the file is located in the directory /etc/httpd/conf. In this directory, we will find where the root of the Web server is; that is, in which directory we will have to place files so they can be seen from the iPAQ. I search on the whole directory, as the information is not necessarily in the httpd.conf file in old Apache versions:

bash# grep DocumentRoot /etc/httpd/conf/*
/etc/httpd/conf/httpd.conf:# DocumentRoot: The directory out of which you will serve your
/etc/httpd/conf/httpd.conf:DocumentRoot "/var/www/html"
/etc/httpd/conf/httpd.conf:# This should be changed to whatever you set DocumentRoot to.
/etc/httpd/conf/httpd.conf:#    DocumentRoot /www/docs/dummy-host.example.com
/etc/httpd/conf/httpd.conf:#DocumentRoot "/etc/httpd/htdocs"

Some other lines that may list errors can be safely ignored. The only interesting thing here is the second line, saying that the DocumentRoot is located in the /var/www/html directory. This may be different for your system.

Using this information, we will create a directory where we will store the files for the iPAQ: let's call it iPAQ:

bash# cd /var/www/html
bash# mkdir iPAQ; cd iPAQ

We then have to launch the Apache Web server. On my Red Hat 7.2 distribution, I can issue either:

bash# service httpd start

or

bash# /etc/rc.d/init.d/httpd start

Depending on your GNU/Linux distribution, you may have to find the right way to do it...

1.4.1.2. Getting the PocketPC mini FTP server

Copy in this directory the FTPS006AP.ZIP file (aka, the ftpserv zipped file), downloaded from the following location:

http://www.oohito.com/wince/arm_j.htm

Unzip the archive using the following command:

bash# unzip FPS006AP.ZIP
Archive:  FTPS006AP.ZIP
  inflating: ftpsvr.exe
  inflating: ftpsvr.txt

We are interested in the ftpsvr.exe file.

1.4.1.3. Downloading the mini FTP server on the PocketPC iPAQ

If everything is OK, you should be able to download the ftpsvr.exe file by fetching the following URL in the Internet Explorer Web browser on the PocketPC iPAQ:

http://192.168.1.100/iPAQ/ftpsvr.exe

Note: You may have to go into the "Display" menu, and enable the "URL bar" option to be able to enter the URL.

A "Download" popup menu should open, asking you if you want to download the ftpsvr.exe file, giving you the option to open it after downloading. I suggest you to check this last option.

On the PocketPC iPAQ, you can now close Internet Explorer and go back to the main "Today" screen. In the lower right corner, you should have a small icon. When you tap on it, a window "FtpSvr for Windows® CE Ver 0.06" should open, that is a little too large on my iPAQ, so you may have to move it around to see it completely.

This window tells you that the FTP server is running, listening on port 21. You have the option to stop it, uninstall it (don't!), or exit.

Everything is ready now to be able to transfer files in both directions.

Whenever you want to restart the mini FTP server, you just have to click on the ftpsvr.exe icon where you saved it after downloading it (normally in the "My Documents" folder).

1.4.2. Transferring files using FTP

On the GNU/Linux host, you can either use the command line ftp, or your favorite graphical FTP client. I will show here the basic, command line option:

bash$ ftp ipaq
Connected to ipaq (192.168.1.101).
220 FtpSvr (Version 0.06).
Name (ipaq:root):
331 Password required for root.
Password:
230 User root logged in.
ftp> passive
Passive mode off.
ftp> 

Warning

The mini FTP server should not be used permanently, as it lacks some important security features. You should only turn it on whenever necessary.

You can now transfer files back and forth:

ftp> ls
200 PORT command successful.
150 Opening ASCII mode data connection for \467456.FTP(782 bytes).
drwxrwxrwx   1 owner    group      0          Jan  1  1998 iPAQ File Store
-rw-rw-rw-   1 owner    group      76         Sep  4  7:44 467456.FTP
-rw-rw-rw-   1 owner    group      282        Sep  4  7:16 mdmlog0.txt
-rw-rw-rw-   1 owner    group      72         Sep  4  7:14 mdmlog5.txt
-rw-rw-rw-   1 owner    group      10500      Sep  4  7:15 GCounterFile.mmf
-rw-rw-rw-   1 owner    group      56         Sep  3 20:00 CMMapP
-rw-rw-rw-   1 owner    group      60         Sep  3 20:00 CMMapG
drwxrwxrwx   1 owner    group      0          Sep  3 12:00 Program Files
drwxrwxrwx   1 owner    group      0          Sep  3 12:00 My Documents
drwxrwxrwx   1 owner    group      0          Sep  3 12:00 Temp
drwxrwxrwx   1 owner    group      0          Sep  3 12:00 Windows
226 Transfer complete.
ftp> put whatever
local: whatever remote: whatever
200 PORT command successful.
150 Opening BINARY mode data connection for \whatever.
226 Transfer complete.
6 bytes sent in 8.4e-05 secs (70 Kbytes/sec)
ftp> ls
200 PORT command successful.
150 Opening ASCII mode data connection for \467456.FTP(851 bytes).
drwxrwxrwx   1 owner    group      0          Jan  1  1998 iPAQ File Store
-rw-rw-rw-   1 owner    group      76         Sep  4  7:45 467456.FTP
-rw-rw-rw-   1 owner    group      6          Sep  4  7:45 whatever
-rw-rw-rw-   1 owner    group      282        Sep  4  7:16 mdmlog0.txt
-rw-rw-rw-   1 owner    group      72         Sep  4  7:14 mdmlog5.txt
-rw-rw-rw-   1 owner    group      10500      Sep  4  7:15 GCounterFile.mmf
-rw-rw-rw-   1 owner    group      56         Sep  3 20:00 CMMapP
-rw-rw-rw-   1 owner    group      60         Sep  3 20:00 CMMapG
drwxrwxrwx   1 owner    group      0          Sep  3 12:00 Program Files
drwxrwxrwx   1 owner    group      0          Sep  3 12:00 My Documents
drwxrwxrwx   1 owner    group      0          Sep  3 12:00 Temp
drwxrwxrwx   1 owner    group      0          Sep  3 12:00 Windows
226 Transfer complete.
ftp> get whatever
local: whatever remote: whatever
200 PORT command successful.
150 Opening BINARY mode data connection for \whatever(6 bytes).
226 Transfer complete.
6 bytes received in 1.01 secs (0.0058 Kbytes/sec)
ftp> bye
221 Goodbye