Windows CE is Microsoft's newest Windows platform, targetted for the embedded systems market. Initially, this market consists mostly of handheld and palmtop pen-based computers (formerly known as PDAs, "personal digital assistants"). But as indicated by their AutoPC design and plans to put CE into set-top boxes and WebTV, Microsoft obviously recognizes that there's a much larger potential for this (relatively) diminutive cousin to Win3.1, 95 and NT, et al.
The communications/networking capabilities are what make CE devices much more powerful than the sum of their (small) parts, and Windows Sockets is a key component for enabling network applications, along with PPP-support and remote dialing capabilities. Data synchronization is the most significant use of the handhelds and palmtops. Hardware configurations vary, but serial and infrared ports are common. Some have a built-in modem or a PCMCIA slot. There are a number of companies with CE-compatible PCMCIA modems available, and there's at least one company (Socket Communications, Inc) that has a PCMCIA Ethernet card (CE 2.0 is supposed to be compatible with any NE2000-compatible PCMCIA card, but that's the only one blessed by Microsoft so far).. And, lest we forget the mobile nature of these machines, there are also wireless interface cards under development for messaging (one and two-way paging), and streams (e.g. using CDPD modems).
Some believe that Residential Networks are going to be one of the Next Big Things. These home networks will be populated by not only PCs that share resources, including a broadband Internet connection (via a cable modem, ADSL, digital satellite, or whatever), but also embedded devices. These may be hand helds and palm tops, but could also be appliances like televisions, stereos, heating systems, alarm systems, video cameras, digital cameras, alarm clocks, automobile, cell phone, and who knows what all else. The possibilities are indeed mind-boggling. "IP over everything" will no doubt be a key enabler, and Windows CE might also.
The best feature of CE is that it provides support for Win32 APIs, MFC (with ATL), and WinSock. Granted, these APIs are only subsets of the Real Thing and there are many portability issues related to disk space, power usage, user interface and peripheral devices (to name a few), but the tremendous number of existing Windows applications represents a potential gold mine. Windows CE is behind the curve in many respects in comparison to other embedded operating systems (e.g. VxWorks, PSoS, OS9, etc.), and although Windows applications tend to be relatively resource intensive, portability represents a significant advantage. Microsoft enhances this advantage with an add-on development environment ntegrates nicely with MSVC++ version 5 (on NT4 or later), and includes the mini-MFC version, and a few samples. It has cross compilers for both MIPS and SH3, an emulator for simulated execution, remote debugging, and it downloads the (release or debug version) to the connected CE device as part of the build process. Microsoft also has CE Dev Kits for Visual Basic and Java (but I haven't tried them).
So, in summary, the purpose of this new addition to the Sockets web site is to explore the possibilities and limitations of the WinSock API implementation on Windows CE. Only time will tell where it goes from here. One thing is for sure, it is here to stay.
WARNING: This page is very much UNDER CONSTRUCTION as I have tested relatively little at this point, and have made quite a few questionable statements that I intend to investigate(marked by "??? need to check"). I also have some place holders that are more for my own benefit than yours (marked by ??? need more info here). Bottom line is that this page is in rough shape as yet... but hey, it's a start!
Please send comments, corrections, contributions or requests. Tell me what you'd like to see here! Thanks in advance - Bob Quinn
Microsoft has a number of Software Development Kits (SDKs) for Windows CE that support C, C++, Visual Basic, and Java. I use the C/C++ version, which is an add-on for Enterprise or Professional editions of Microsoft Visual C++ version 5.0 (but not with the Learning Edition). Although explicitly designed to run on NT version 4 or later, according to Craig Peacock's FAQ the MSVC 5 CE SDK can be used on Windows 95 with some limitations (e.g., the emulator and remote tools don't function properly). Actually, now even the Microsoft literature says you can use the SDK on Windows 95 (and warns the emulator doesn't work).
I've had very good experience with the CE SDK so far. I like the emulator and the fact the build process downloads the executable to a connected HPC. I'd be happier if I could get it to work with the Ethernet interface on my handheld, but as long as I can use the Ethernet interface while connected to the SDK machine via that serial interface, I'm happy. One tool I haven't figured out how to get running is the remote process monitor (I don't know what the client piece is, or what DLLs it needs). That would be nice.
For more information about the CE SDKs, see the Microsoft Windows CE developer website.
NOTE: Most of the information on the WinSock API was garnered from the documentation in the Windows CE SDK for Microsoft Visual C++ version 5.0, and also available online from http://premium.microsoft.com/msdn/library/sdkdoc/wince/wceover_5y2c.htm (you may need to subscribe to access this "premium" information, but fortunately Microsoft does not charge for access). Microsoft has also added Windows CE references to the online WinSock API documentation at http://premium.microsoft.com/msdn/library/sdkdoc/pdnds/sock2/wslegal_0twy.htm (interestingly, some of the references conflict, as noted below).
The TCP/IP and IrDA protocol stacks are available in WinSock on Windows CE (both versions 1.0 and 2.0 of Windows CE support these, but this page is version 2.0 specific).
Protocol Suite |
Family |
Structure |
Protocol(s) |
Type(s) |
TCP/IP |
AF_INET |
SOCKADDR_IN |
TCP and UDP |
SOCK_STREAM, |
IrDA (Infrared) |
AF_IRDA |
SOCKADDR_IRDA u_short irdaAddressFamily; |
TCP only |
SOCK_STREAM |
Windows CE supports a subset of the WinSock 1.1 API, as listed in the table below. Notice that most of these are Berkeley Sockets compatible APIs, and four are WinSock-native (WSA) functions. The other missing WinSock 1.1 functions are:
Interestingly, WinSock on Windows CE also has a single WinSock 2 API--WSAIoctl()--which supports the Secure Sockets Layer (SSL) protocol versions 2.0 and 3.0, and the Private Communication Technology (PCT) version 1 security protocol (for a complete list of the protocols, crypto algorithms, et al, registry entries). This is useful for SSL-enabling any TCP-based application, not just http (secure web).
Here's a list of the WinSock functions available on Windows CE from the 32-bit WINSOCK.DLL. These are compatible with the 32-bit APIs from Win95 and NT WSOCK32.DLL (unlike 95 or NT, CE does not provide any 16-bit application support).
Function |
Differences from standard WinSock |
accept() * |
none. |
bind() * |
none. |
closesocket() * |
none. |
connect() * |
|
gethostbyaddr() |
|
gethostbyname() |
|
gethostname() |
|
getpeername() |
none. |
getsockname() * |
With IrSock:
|
getsockopt() |
Options Supported: (need to check ???)
|
htonl() |
none. |
htons() |
none. |
inet_addr() |
none NOTE: Input IP Address string must be ANSI, not UNICODE. |
inet_ntoa() |
none NOTE: This returns an ANSI string which requires conversion to UNICODE for display. |
ioctlsocket() |
For SSL support:
OpCodes Supported: (need to check ???) |
listen() * |
none. |
ntohl() |
none. |
ntohs() |
none. |
recv() * |
MSG_PEEK flag removes data from the incoming buffer (which it
should not do). NOTE: This bug report came from a reliable source, but I have yet to test it. |
recvfrom() |
MSG_PEEK flag removes data from the incoming buffer (which it
should not do).. NOTE: This bug report came from a reliable source, but I have yet to test it. |
select() |
none. |
send() * |
none. |
sendto() |
With a SOCK_DGRAM (UDP) socket:
|
setsockopt() * |
With IrSock:
Options Supported: (still others to check)
|
shutdown() |
none. Works as advertised in CE2 (how=1 sends TCP <FIN>),
NOTE: An experienced source warned that shutdown(how=1) hangs in CE1. |
socket() |
none. Requests for raw ICMP sockets--type=SOCK_RAW--fail with 10047, WSAEAFFNOSUPPORT. |
WSACleanup() * |
none. |
WSAGetLastError() |
none Same 10000 WinSock error bias, (e.g. 10060 for WSAETIMEDOUT) |
WSAIoctl() |
For SSL Support**:
|
WSASetLastError() |
none. NOTE: The CE SDK docs say this works, and my testing indicates it does, but the online WinSock API docs say that this function isn't not supported in Windows CE. |
WSAStartup() |
WSAData contents upon return after version 1.1 requested:
wVersion: 1.1 NOTE: When I requested version 2.2 it happily accepted it and told me wVersion: 2.2, wHighVersion: 2.2 |
* These APIs represent the subset available with an IrDA socket (see below for more information). Also note that WSAStartup(), WSACleanup(), WSAGetLastError() and WSASetLastError() are all also relevant to applications using IrSock. They aren't hightlighted in the table simply because they don't reference AF_IRDA socket handles explicitly.
** Although the Windows Sockets 2 Protocol Specific Annex includes a specification for SSL support using WSAIoctl(), these APIs are different than those. Note also, that SSL is also available via the "SChannel" ActiveX APIs.
Microsoft WinSock Extensions
Other Comm APIs
The focus of this webpage is WinSock, but in passing I'd like to note the (many) other communications APIs available. Minimizing code size is of paramount importance in CE, so using built-in libraries is sensible whenever possible. Good to know what's available.
Internet APIs:
HTTP APIs:
FTP APIs:
Email APIs (SMTP & POP3 and IMAP4 ??? need to check):
RAS (dialer):
Rapi (Remote Access Programming Interface):
SMB APIs:
Raw Serial APIs (the serdev component):
The WinCE 2.0 SDK documentation states that ICMP Echo Request/Reply (e.g. "ping") is supported via the Microsoft proprietary APIs (same as available on Win95 and NT in the ICMP.DLL). These are the functions IcmpCreateFile(), IcmpSendEcho(), IcmpCloseHandle(). However, these APIs are not available in WinCE 2.0 implementations shipping at the time of this writing (I have an HP 360LX that does not have either a ping or traceroute utility).
I have heard from a reliable source that the latest Windows CE Embedded Toolkit has an ICMP.LIB (no .DLL needed), but it doesn't come with the 2.0 SDK for Visual C++. Sigh... Life without ping is pangful.
On the brightside, WinCE does at least respond to ping requests from other IP hosts.
With an Infrared Data Association (IRDA) socket, only a subset of WinSock functions are available with some modifications, as noted in the function table above. You will notice that for the most part, the APIs not included deal with addresses, names or datagram sockets.
IRDA sockets don't have hostnames, and their addressing is unique (??? need more info here).
IRDA connections are reliable (??? need more info here).
The IRDA sockets all use the IrDA-compabitible infrared interface built-into the WinCE devices to communicate with printers (e.g. HP LaserJet 6P) and computers similarly equipped with IrDA-compatible interfaces. AF_IRDA sockets can only be used with TCP--socket type SOCK_STREAM--not UDP, although a raw mode is possible (see setsockopt() IRLMP_RAW_MODE ??? need more info here).
Registry Entries
Windows CE has a Registry that--as on NT and 95--reveal many interesting things about the system, and provide some configurable options not otherwise available. Here's a collection of things that seem interesting (to me). I haven't had the courage to experiment with much yet. I'm sure this isn't terribly useful to many in its current form, but anyway...
HKLM: Abbreviation for "HKEY_LOCAL_MACHINE"
TCP/IP settings
HKLM\Comm\Tcpip\
Hosts\ --> this entry seemed dynamic according to host connected with
remote host name\
ExpireTime - Values: , Data Type: <- Without
this key entries will persist, which makes this like a HOSTS file!
aliases - Values: , Data Type:
ipaddr - Values: , Data Type:
Parms\
IpEnableRouter - Values: , Data Type:
Linkage\
Bind - Values: , Data Type:
HKLM\Comm\ppp\
Subnetmask - Values: , Data Type:
IpAddress - Values: , Data Type:
UseZeroBroadcast - Values: , Data Type:
LLInterface - Values: , Data Type:
IpInterfaceCo?? - Values: , Data Type:
HKLM\Comm\NE20001\Parms\Tcpip\
IpAddress - Values: , Data Type:
Subnetmask - Values: , Data Type:
DefaultGateway - Values: , Data Type:
EnableDHCP - Values: , Data Type:
DNS - Values: , Data Type:
WINS - Values: , Data Type:
Infrared Interface
HKLM\Comm\IrDA
Security Protocols and Algorithms
HKLM\Comm\SecurityProviders\SCHANNEL\
CAs - Values: , Data Type:
Ciphers - Values: , Data Type:
Hashes - Values: , Data Type:
KeyExchAlgs - Values: , Data Type:
Protocols - Values: , Data Type:
Windows CE 2.0 provides support for TCP/IP over Ethernet using NE2000-compatible PCMCIA cards. Obviously, they provide much faster network access than a serial or Infrared interface can, and now that I avoid the routing problems I've had with serial and infrared interfaces, the Ethernet card has made testing WinSock applications much easier.
I can successfully synchronize over Ethernet (as described here), although due to my particular configuration I must have a Wins Server configured on my H/PC Ethernet interface and not a DNS Server. My partner machine has Windows 95 and two Ethernet interfaces, the outside of which is the default (with a gateway address assigned). I think this configuration is the crux of the problem in the final analysis. Here're my bug report details:
Here's a picture of the configuration: +--------------+ | Twister | +---------+ Internet----Cable----< Win95 >-----Ethernet-----< Tricord | Modem | H/PC Partner | | H/PC | +--------------+ +---------+ 24.128.34.101 206.105.153.8 206.105.153.6 TWISTER is the hostname I reference in "Connect to:" when I attempt to start ActiveSync with Network Connection from Tricord. WinGate is running on Twister, and configured to do proxy DNS. It is significant to note that the 24.128.34.101 interface is the default on Twister, since it has a gateway address assigned. The 206.105.153.8 interface does *not* have a gateway address configured. When I have the Ethernet interface on Tricord configured with a WINS server and no DNS server, I *AM* able to synchronize the two systems successfully. The problem occurs when I have a DNS server configured on the Ethernet interface on Tricord (and it doesn't matter whether or not a Wins Server is configured). A network trace reveals the following: 1) Tricord sends out a DNS query to 206.105.153.8 for "TWISTER" 2) Twister responds with a successful DNS response with the address for TWISTER (a.k.a. twister.cyko.com) as 24.128.34.101 3a) ActiveSync fails immediately with "Communications Error" message box that says WinSock failed with error 10065 if I do not have a gateway configured for the Ethernet device. 3b) ActiveSync *seems* to connect (it makes the H/PC connection sound on Twister and opens the Mobile Devices window, and on Tricord it says "Checking for partnership with this computer, Please wait...). But it never proceeds from there. Shortly thereafter, it fails (on Tricord the "Connecting to Desktop" message box says "ActiveSync not responding on the desktop computer." A Network trace in this case reveals that: a) Tricord successfully connects to TCP port 5679 on 24.128.34.101 b) Then Tricord FAILS its *many* attempts to connect to the TCP port 999 on 24.128.34.101, each of which is reset by Twister.
I was able to work-around the problem described here by adding a static entry to the WinCE 2.0 "HOSTS" file equivalent entry to the Registry, which effectively avoided the DNS lookup that was causing confusion.. I added the key /HKLM/Comm/Tcpip/TWISTER and the values ipaddr (DWORD): 0xce699908 and aliases (String): "{twister.cyko.com}"
Ok, now I'm over that hump and I have ActiveSynch working. Next it would be REAL NICE to be able to use the CE SDK (i.e. Visual C++) with the CE machine attached via Ethernet rather than serial, but I realize that is asking too much (at least for now).
PCMCIA Card Installation Tips
The NE2000-compatible drivers must be installed manually. You can find them among the Optional Components on the Windows CE CD-ROM. As described in the installation instructions on the CD-ROM (in ethernet_readme.txt), you need to copy the binaries to the Windows directory on your HPC (ARP.DLL, DHCP.DLL, NDIS.DLL, NE2000.DLL, NETWORK.CPL). Then insert the PCMCIA card (if it prompts for a driver name, use "NE2000"), and finally configure for IP as prompted. In my case, it worked first try!
So far, the only PCMCIA card Microsoft themselves have tested is from Socket Communications, Inc (http://www.socketcom.com), but I have had luck with the NDC 5100 from ND Communications, Inc. (http://www.ndclan.com), others have reported success with others (e.g. Linksys EC2T), there are quite a few other drivers listed in the HPC registry (in HKLM\Drivers\PCMCIA), but Chris De Herrera reported failure with at least one also (e.g. SVEC NE2000).
The problem with unsupported cards like my NDC 5100 and the LinkSys EC2T is that the HPC prompts for a driver name each time you insert the card. It is easy enough to get the card working by entering "NE2000" each time, but it is annoying. I solved it with help from Carlos A. Santiago's tip, which describes how to modify the registry in a HPC to accomodate an unsupported card. It's not online any longer, but what it used to say was (I paraphrase): use a CE Registry Editing Tool (like the remote version in the CE SDK, or the stand-alone from Grundle Software) you should add the device name found in the .INF file for your adapter to HKEY_LOCAL_MACHINE\Drivers\PCMCIA registry hive. For my NDC 5100 PCMCIA card, I added "NDC-Ehternet-0197" with the keynmames and values (all strings): Dll: ndis.dll, Prefix: NDS, Miniport: NE2000
Sidenote: At first I tried all five of the "Device IDs" I found in the .INF file for my card ("NDC-Ethernet-xxxx", where xxxx .was 24A3, 0197, 6BF4, 6669, CB56), but none of them worked. I then tried installing my card in my Win95 laptop, and checked the Device ID value the installation procedure put into the registry (HKLM\Enum\PCMCIA\NDC-Ethernet-0197). I put this key name in HKLM\Drivers\PCMCIA in the registry of my HPC (using the Remote Registry Editor from the Windows CE SDK tools menu) and also assigned the same fields and values as for the NE20001 entry, and it worked (note that the NE2000 key is linked to the NE20001 key )! Now I don't get prompted for a driver name each time I insert the card any more.
Although Windows CE provides support for a significant subset of the standard Win32 APIs, and even the Micorosoft Foundation Class (MFC), there are a number of unique characteristics one should note about the Windows CE platform. These are WinSock independent, but affect all WinSock applications.
http://www.microsoft.com/windowsce - Microsoft's official Windows CE website
http://www.windowsce.com - HPC.net: Windows CE and Handheld Computing Software, News, Links, and More...
http://www.winceonline.com - WindowsCE On-Line: up-to-the-minute CE news, and good links
http://www.jimmy.com/morency/wishpie.html - Christian Morency's Windows CE Application Wish List
http://www.cegate.com - Fred Bouvry and Christian Morency provide "a gateway to WindowsCE," with the goal of sharing developer info!
http://members.aol.com/pdcchrisd/index.htm - Chris D's Pen-Based Computers (comprehensive FAQs, including one on Ethernet!)
http://www.geocities.com/SiliconValley/8005/620zone/620tips.htm - HP 620 tips, but some are relevant to others (e.g. Ethernet tip referenced earlier).
http://www.webring.org/cgi-bin/webring?ring=windowsce&list - Windows CE Web Ring: Lots of links to Windows CE websites
http://www.surerange.com/links.html - Lots of links to Windows CE related websites (and a mail list to notify you of new updates!)
Dev Tools
http://lists.windowsce.com/developers/ - Windows CE developers' mailing list (need to be a subscriber to access the archive)
http://www.ruksun.com - Some helpful developer tools (e.g. TraceTool, TFTP Server, NSLookup/WhoIs/Finger)!
http://www.inet-1.com/~spamman/wince.htm - Registry editor and File Size utility (called SpaceHog)
http://www.applian.com/products/CEInstall/ceinstall.htm - CE Install utility (a commercial product, with source code)
http://www.microsoft.com/windowsce/developer/download/ - Microsoft WinCE Developer Download Site
Source Code
http://www.oohito.com/ - RegEdit, Console, and others. Site is mostly in Japanese, and download files are LZH compressed files.
Shepard, G. and Wingo, Scot, Mini MFC Revealed, Dr Dobb's Journal, October '97
May '98 issue of Microsoft Journal, on newstands April 17 is dedicated to Windows CE
Updated 11/25/98 (c) Bob Quinn, 1995-1998