Example: interface on server -7, Example: interface on server – Rockwell Automation 2727-M7P20D1P1, -M7P20D1Q2,-M7P20D1Q3 MobileView Machine Terminal MT750 User Manual
Page 88

Publication 2727-UM003D-EN-P
6-6 Windows CE Applications
Example: Interface on Server
On the server side, the VC protocol is represented by two classes:
CKVCServerand CKVCConnection. An object of the CKVCServer class
represents the actual server (the "listener") and an object of the
CKVCConnection class represents a connection to a client.
"Server class"
class CKVCServer {
public:
virtual CKVCConnection* OnClientConnect(const char *pIpAdr)= 0;
virtual int OnClientDisconnect(CKVCConnection *pConnection,
TDisconInfo info);
};
CKVCConnection* OnClientConnect(SOCKET socket, sockaddr_in &sockAdr);
This method is always called when a terminal establishes a connection
to the control. The parameters socket and sockAdr specify the
connection parameters of the terminal. This function must return a
pointer to an object of the CKVCConnection class. A return value of
0 indicates that the control rejects the logon of the terminal.
int OnClientDisconnect(CKVCConnection *pConnection, TDisconInfo info);
This method will be called if the server cannot reach the client any
more. The cause of the logoff is specified in info.