Important:
This is retired content. This content is outdated and is no longer being maintained. It is provided as a courtesy for individuals who are still using these technologies. This content may contain URLs that were valid when originally published, but now link to sites or pages that no longer exist.
4/8/2010

This code sample is named SocketApp. It demonstrates the use of Windows Socketsto communicate with a mobile device. First, SocketAppuses Remote API (RAPI)interfaces to get the mobile device's IP address through ActiveSync. Second, SocketAppsends a "hello" string to the mobile device, and then listens for the mobile device to respond.

Feature Area

Relevant APIs

Usage

To run the code sample

  1. 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 Mobile 6.5.3 DTK\Samples\Common\CPP\Win32\SockApp

    Microsoft Visual Studio launches and loads the solution.

  2. Open the Toolsmenu in Visual Studio, and navigate to Options, expand Projects and Solutions, and click VC++ Directories.

  3. In Show directories for:, select Include files.

  4. Add the path to the ActiveSync include directory. The default locations are:

    C:\Program Files\Windows Mobile 6.5.3 DTK\Activesync\inc

  5. In Show directories for:, select Library files.

  6. Add the path to the ActiveSync library directory. The default locations are:

    C:\Program Files\Windows Mobile 6.5.3 DTK\Activesync\Lib

  7. Build the solution (Ctrl+Shift+B).

  8. Deploy the solution (F5).

To use the application

  1. Connect the mobile device.

  2. Launch "SocketSRV.exe" on the mobile device.

  3. Launch "SocClient.exe" from the desktop computer.

Development Environments

SDK:Windows Mobile Professional SDK and Windows Mobile Standard SDK

Development Environment:Visual Studio 2005 or 2008.

ActiveSync:Version 4.5.

Comments

The project file assumes that the Visual Studio default header and library search paths have been updated appropriately. For example, a Windows Mobile SDK will install ActiveSync library and header files to the following default locations:

C:\Program Files\Windows Mobile 6.5.3 DTK\Activesync\inc

C:\Program Files\Windows Mobile 6.5.3 DTK\Activesync\Lib

See Also