Creating an Infrared Winsock Application

Windows Mobile 6.5
A version of this page is also available for

Windows Embedded CE supports socket-based infrared communications called Infrared Sockets (IrSock) by using industry standard Infrared Data Association (IrDA) Protocols. Applications implement Infrared Sockets in the same way as conventional Winsock, although several Winsock functions are used differently with IrDA than with TCP/IP.

Conventional Winsock name service is best suited to fixed networks, in which the group of devices that can accept a socket connection is relatively static. Conversely, IrDA is designed to handle browsing for resources within range. It works in an extemporary manner, and devices disconnect and connect frequently as they move in and out of range.

Because of these differences, IrSock does not use the conventional Winsock name service functions. Instead, name service is incorporated into the communication stream.

Addressing is based on Logical Service Access Point Selectors (LSAP-SELs), numbered from 1 through 127. Because of the small range of values available, it is usually better not to bind sockets directly to an LSAP-SEL. Instead, the Information Access Service (IAS) provides means for dynamic selection of LSAP-SELs.

To use IAS, a server application binds a socket to an IAS service name. The client application uses the service name when using the connect function. Neither application must be notified of the LSAP-SEL assigned by the IAS.

To create IrSock-based applications, use the Winsock extensions for IrDA. You must include the Af_irda.h header file in your application to access the Winsock extenstions. Information specific to IrDA is provided under Notes for IrDA Sockets.

The following topics provide information about using these functions in IrSock applications: