Winsock Control

The Winsock control, invisible to the user, uses infrared to provide two-way communication between a Windows CE device and a main computer. The Winsock control uses the IrDA protocol to provide this capability.

Syntax

Winsock

The properties, methods and events of the Windows CE Winsock control are described in the following table.

Properties Methods Events
BytesReceived Accept Close
LocalHostName Close ConnectionRequest
LocalIP Connect DataArrival
LocalPort GetData Error
Name Listen SendComplete
Parent SendData SendProgress
Protocol
RemoteHost
RemoteHostIP
RemotePort
SocketHandle
State
ServiceName

Remarks

The Transfer Control Protocol allows you to create and maintain a connection to a remote computer. Using the connection, both computers can stream data between themselves.

If you are creating a client application, you must know the server computer's name or IP address (RemoteHost property), as well as the port (RemotePort property) on which it will be "listening." Then invoke the Connect method.

If you are creating a server application, set a port (LocalPort property) on which to listen, and invoke the Listen method. When the client computer requests a connection, the ConnectionRequest event will occur. To complete the connection, invoke the Accept method within the ConnectionRequest event.

Once a connection has been made, either computer can send and receive data. To send data, invoke the SendData method. Whenever data is received, the DataArrival event occurs. Invoke the GetData method within the DataArrival event to retrieve the data.