Build a Linux and Windows CE Network

Source: Internet
Author: User
Background

Linux is a UNIX-like operating system. It originated from a hobby called LinusTorvalds in Finland, but is now the most popular free operating system. Ordinary users work on Linux, browse websites, send emails, and play games. Many universities and research institutions also use Linux to complete daily computing tasks. In the commercial field, many companies have built their own servers on the basis of Linux because of low price, high security and stability of Linux systems. According to IDC statistics, about 1/3 of the world's website servers use Linux as the operating system.

WindowsCE, according to Microsoft's definition in WindowsCE and PocketPC: FAQ, is a series of components used by operating system developers to build a proprietary operating system. The original equipment manufacturer (OEM) can purchase an integrated development environment called "WindowsCE platform development system" from Microsoft and use this system to assemble and compile Windows SCE-based operating systems, the operating system includes a series of Windows CE-based components and applications or device drivers developed by developers. Because Windows CE-based operating systems have similar user interfaces as Microsoft Windows operating systems, they are favored by many end users and developers. Currently, WindowsCE has been widely used in mobile phones, palm computers, personal digital assistants, quick translation, electronic dictionaries, and other portable devices.

For a long time, WindowsCE devices also need to be equipped with a host based on Windows9x/2000/NT for data exchange with Windows CE devices. Run the WindowsCE service software provided by Microsoft on the host. The software establishes a point-to-point connection with the WindowsCE device through a RS-232 data cable. the user can access the WindowsCE device through the service software, however, other computers in the LAN cannot access the WindowsCE device. If you want other computers in the LAN to access the device, you need to install expensive dedicated NICs and related access devices for the device. This is a very economic solution.

This document uses the PPP server of the RedHatLinux7.2 operating system to establish a TCP/IP connection with the WindowsCE device, then, run an FTP server on the Windows CE device so that the Linux host can access resources on the Windows CE device. This method is a cost-effective solution because it is based on the RS-232 data cable that comes with Windows CE device and does not need to purchase any additional device. In addition, the solution described in this article is also applicable to Windows 9x/2000/NT hosts.
Connect Linux to Windows CE

Point-to-Point Protocol (PPP) is a Protocol for transmitting IP data packets through a serial port. Using the PPP protocol, a computer can log on to a remote host through a serial line, telephone line, and other communication devices and use the resources of the host or the network where the host is located. In point-to-point communication, two parts are included: the server and the client. The client requests a network connection from the server, and the server receives client requests to establish a network connection and allocate the network resources to the client. After the network connection is established, the server and the client are strictly equal. Linux usually has PPP servers and client programs, while Windows CE usually only has PPP client programs. Therefore, we use Linux Hosts as PPP servers, the Windows CE device acts as the PPP client.

To use a Linux host as a PPP server, we must first check whether the PPP server program pppd has been installed on the host. This program is usually installed in the/usr/sbin directory. We can use the following command to check whether the file exists in this directory:

Ls/usr/sbin/pppd

The recently officially released Linux operating systems (such as RedHatLinux6.x/7.x) usually have pre-installed PPP server programs. If the PPP server has not been installed on the Linux host, we should first download and install a PPP server program, such as pppd2.3.4. The installation of this package may also require support from other packages. As the installation of the application program is beyond the scope of this article, please refer to other related materials for interested readers.

After confirming that the PPP server has been installed on a Linux host, we need to make some necessary configurations for the Linux host. To perform these configurations, we need to have the root permission.

Create a file/etc/PPP/peers/wince with the following content:


     
      /dev/ttyS0 115200 crtscts        connect '/usr/sbin/chat -v -f /etc/ppp/wince.chat'        noauth        local        90.0.0.1:90.0.0.2
     

Create a file/etc/PPP/wince. chat with the following content:


     
      TIMEOUT 3600        "CLIENT" "CLIENT/c"        "" "SERVER/c"
     

In the preceding two configuration files, using wince as the file name only indicates that this configuration file is used for a Windows CE device. You can also choose another file name, such as palm or handheld, but ensure that the two file names are consistent.

The configuration file/etc/PPP/peers/wince specifies that the serial port ttys0 is used to establish a connection with the customer device at a rate of 115,200 bps. The noauth parameter indicates that no authentication is required when the client requests a connection. In this peering connection, the IP address of the server (Linux host) is 90.0.0.1, And the IP address of the client (WindowsCE device) is 90.0.0.2. The timeout parameter in the configuration file/etc/PPP/wince. Chat specifies the server wait time. If the server still does not receive the client connection request after this time, terminate the current server program. If you need to learn more about the configurations, refer to the relevant documents of chat and pppd.

The configuration required on the WindowsCE device is relatively simple. Because WindowsCE's default automatic connection function occupies the serial port of the device, we need to stop using this function first. Choose "Settings"> "communication"> "PC connection" from the Start menu and disable the connection to the PC. Then, create a new connection, select "program-> communication-> Connection Manager" from the Start menu, and click the "Create connection" icon, name the new connection as Linux and specify the connection type as "linear connection". In the next step, specify COM1 for the connection and set the communication rate to 115,200, in TCP/IP Settings, specify the IP address of the device as 90.0.0.2. After you click OK to save the disk, the connection will appear in the "program-> communication" menu.

Run the following command to start the PPP server on a Linux host:

Pppd call WinCE

After you start a new connection (program> communication> Linux) on a Windows CE device, the network connection diagram is displayed on the taskbar of the Windows CE device, on the Linux host, the following information is displayed, indicating that the connection has been successfully established with the Windows CE device:


     
      Serial connection established.        Using interface ppp0        Connect: ppp0 <--> ttyS0        found interface eth0 for proxy arp        local  IP address 90.0.0.1        remote IP address 90.0.0.2
     

We can also use the Ping Command provided by the Linux host to verify whether the connection has been successfully established with the Windows CE device:

Ping 90.0.0.2

If the Linux host has successfully established a connection with the WindowsCE device, we should be able to see information similar to the following:


     
      PING 90.0.0.2 (90.0.0.2) from 90.0.0.1 : 56(84) bytes of data.        64 bytes from 90.0.0.2: icmp_seq=0 ttl=32 time=26.587 msec        64 bytes from 90.0.0.2: icmp_seq=1 ttl=32 time=19.928 msec        64 bytes from 90.0.0.2: icmp_seq=2 ttl=32 time=19.939 msec        64 bytes from 90.0.0.2: icmp_seq=3 ttl=32 time=19.947 msec
     


FTP software based on Windows CE

After we successfully establish a PPP connection between the Linux host and the WindowsCE device, what should we do next? Of course, we need some suitable programs to exchange files between Linux Hosts and WindowsCE devices. We have now been able to use the TCP/IP protocol to transmit data between Linux Hosts and Windows CE devices. Obviously, the FTP program is a suitable choice.

FTP (FileTransportProtocol) is a widely used protocol for file exchange over the network. Due to the requirement of Data Transmission reliability, FTP is a transmission protocol based on TCP/IP. An FTP session includes a server and a client. The client actively connects to the server and sends a file transfer request to the server. The server waits for the client to access and process the file transfer request from the client.

Pe ftp Explorer is a very popular FTP client software based on WindowsCE. It is also a fully functional file browser. Similar to FTP clients such as CuteFTP and WSFTP that are commonly used on PCs, users can use the mouse (pointer) to compress the directory tree on the local end and server end, and upload or download files and directories, you can also rename or delete files or directories. This software is available from the CEArchive website (http://www.cearchives.com/ftp.html. Readers can also find another popular FTP client, vxFTP.

Although FTP client software has been very complete and easy to operate, it is still inevitable to receive the limitation of the portable device's small display. If you can create an FTP server on a portable device, file transfer can be performed on a Linux host using a common FTP client.

Ftpsrv.exe is such an FTP server software based on Windows CE. This 28.5 KB small program can process most common FTP requests except for providing identity authentication and Passive transmission mode. Use Microsoft's windowsceservice software to upload ftpsrv.exe to any directory of the portable device. After the program is started, a small icon similar to a computer connecting two portable devices appears on the task bar. A small control window will appear when you click this icon using the pointer. Here we can change the port number of the FTP server or terminate the program.

Ftpsrv.exe can be accessed from http://pda.tucows.com/#: http://www.oohito.com. Readers of these two websites can also find more useful applets.

Others

If you are using a Windows 9x/2000/NT host, you can also use the Windows linear cable connection function to establish a PPP connection with the Windows CE device.

For example, on a Windows host, choose Settings> network and dial-up connections> new connection from the Start Menu. In the subsequent Network Connection Wizard, select to connect directly to another computer and configure the machine as a host. After selecting the appropriate communication port and configuring the communication rate, the host is used as a PPP server to wait for client access. Similarly, create a new connection on the WindowsCE device, specify the appropriate communication port and configure the communication parameters, and then establish a point-to-point connection with the Windows host. Because the Windows host is already equipped with a dynamic IP Address Allocation (DHCP) server, the WindowsCE device can either use a static IP address or a dynamic IP address allocated by the server in real time. However, because the maximum transmission rate allowed by the linear cable connection is 19,200 bps, the use of Windows9x/2000/NT host as a PPP server does not seem to be as practical as a Linux host.

If you set the PPP server as a gateway, all machines in the LAN can access the WindowsCE device connected to the network by modifying the gateway. On a Linux host, you can use ipchains to set the host to a transparent gateway. on a Windows 9x/2000/NT host, you can use proxy server software such as WinProxy to set it to a transparent gateway. If you need to learn more about how to set a Linux or Windows host as a transparent gateway, read other references.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.