00001 #include "Aria.h"
00002
00007
00008
00009
00010
00011
00012
00013
00014 void test(char **argv, int argc, ArSocket *socket)
00015 {
00016 int i;
00017 printf("Client said: ");
00018 for (i = 0; i < argc; ++i)
00019 printf("\t%s\n", argv[i]);
00020 printf("\n");
00021 socket->writeString("Thank you, command received.");
00022 }
00023
00024
00025 int main(int argc, char **argv)
00026 {
00027
00028 Aria::init();
00029
00030 ArNetServer server;
00031
00032 ArGlobalFunctor3<char **, int, ArSocket *> testCB(&test);
00033
00034
00035
00036 if (!server.open(NULL, 7171, "password", true))
00037 {
00038 printf("Could not open server.\n");
00039 exit(1);
00040 }
00041
00042
00043 server.addCommand("test", &testCB, "this simply prints out the command given on the server");
00044 server.addCommand("test2", &testCB, "this simply prints out the command given on the server");
00045
00046
00047
00048
00049 while (server.isOpen() && Aria::getRunning())
00050 {
00051 server.runOnce();
00052 ArUtil::sleep(1);
00053 }
00054 server.close();
00055 return 0;
00056 }