1 #include "RakNetworkFactory.h"
2 #include "RakPeerInterface.h"
3 #include <stdlib.h>
4 #include <cstdio>
5 #include <cstring>
6 #include "Kbhit.h"
7 
8 #include "NetworkIDObject.h"
9 #include "NetworkIDManager.h"
10 #include "PacketConsoleLogger.h"
11 #include "GetTime.h"
12 
13 /*
14  Both Server and Client are compiled into this sample, but to better understand the use of RPC,
15  consider RunAsServer, and RunAsClient like two separated programs.
16 
17  To test, run two instances of the program. Run one as the Server, and then one as the Client.
18 */
19 void RunAsClient(void);
20 void RunAsServer(void);
21 
main(void)22 void main(void)
23 {
24 
25 	printf("S - Run as Server\n");
26 	printf("C - Run as Client\n");
27 	int ch;
28 	do {
29 		ch = getch();
30 	} while(!((ch=='s')||(ch=='S')||(ch=='c')||(ch=='C')));
31 
32 	if ((ch=='s')||(ch=='S')){
33 		RunAsServer();
34 	} else {
35 		RunAsClient();
36 	}
37 }