Time Server Synchronization
This code sample is named CMTime. It demonstrates how to use Connection Manager to establish a connection to a Time Server, and synchronize the Smartphone's internal clock.
- ConnMgrReleaseConnection function
- ConnMgrEnumDestinations function
- ConnMgrEstablishConnection function
- TCP sockets
To run the code sample
Navigate to the solution file (*.sln), and double-click it. By default, the solution file is copied to the following folder:
C:\Program Files\Windows CE Tools\wce500\Windows Mobile 5.0 Smartphone SDK\Samples\CPP\Win32\Cmtime\CMTime.sln
Microsoft Visual Studio 2005 launches and loads the solution.
Build the solution (Ctrl+Shift+B).
Deploy the solution (F5).
The sample consists of two solutions
This is the Smartphone solution.
This is a Win32 console application that mimics a Time Server for use with the CMTime device sample. When you run TimeServer.exe the command window will indicate activity when an application connects to get the time.
If you want to use this code sample to connect to a Time Server on the Internet, you can set the IP address for that server in g_in_addr. You can substitute the IP address of any Time Server that supports Time Protocol (RFC-868).
Using a Time Server on the Internet requires that your computer be able to access port 37. Depending on your network and proxy server configuration, you may need to ask your network administrator or help desk what you need to do to access traffic on port 37. Generally, this will require you to install or configure a proxy client on your desktop computer. If your network is not allowing port 37 traffic through to your computer, you will see the message "...Finding Connection..." in the CMTime application window, for about one minute followed by the message "Error getting time!"
For more information on Time Servers, see How to Configure an Authoritative Time Server in Windows Server 2003 on MSDN.
Smartphone SDK: Windows Mobile 5.0 Smartphone SDK.
Development Environment: Visual Studio 2005.
ActiveSync: Version 4.0.
Send Feedback on this topic to the authors