
} TKVCCommand;
typedef struct {
TKVCCommand command;
SINT16 param;
} TKVCServerData;
7.9.3
Example: Interface on Server
On the server side, the KVC protocol is represented by two classes:
CKVCServer
and
CKVCConnection
. An object of the
CKVCServer
class
represents the actual server (the "listener") and an object of the
CKVCCon-
nection
class represents a connection to a client.
7.9.3.1
"Server class"
class CKVCServer {
public:
virtual int Init();
virtual int Exit();
virtual CKVCConnection* OnClientConnect(SOCKET socket,
sockaddr_in &sockAdr);
virtual int OnClientDisconnect(CKVCConnection *pConnection,
TDisconInfo info);
POSITION ConnectionListHeadPos();
CKVCConnection* ConnectionListGetNext(POSITION pos);
int ConnectionListGetCount();
};
int Init();
Initalizes the server and opens the port 0xCEBA for incoming connections.
int Exit();
Finishes all connections and closes the port 0xCEBA.
●
CKVCConnection* OnClientConnect(SOCKET socket, sock-
addr_in &sockAdr);
This method is always called when a teach pendant establishes a connec-
tion to the control. The parameters
socket
and
sockAdr
specify the
connection parameters of the teach pendant. This function must return a
pointer to an object of the class
CKVCConnection
. A return value of 0
indicates that the control rejects the logon of the teach pendant.
●
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.
●
POSITION ConnectionListHeadPos();
This method returns the position of the first entry in the OpenConnection
list.
●
CKVCConnection* ConnectionListGetNext(POSITION pos);
This method returns a pointer to the ConnectionObject that is stored on the
position pos in the OpenConnection list.
●
int ConnectionListGetCount();
This method returns the number of connections that are stored in the
OpenConnection list.
Software
© KEBA 2009
User's Manual V1.50
81
Summary of Contents for KeTop T100
Page 1: ...KEMRO KeTop T50VGA User s Manual V1 50 Translation of the original instructions ...
Page 4: ......
Page 10: ......