#include "Aria.h"
void test(char **argv, int argc, ArSocket *socket)
{
int i;
printf("Client said: ");
for (i = 0; i < argc; ++i)
printf("\t%s\n", argv[i]);
printf("\n");
socket->writeString("Thank you, command received.");
}
int main(int argc, char **argv)
{
Aria::init();
ArNetServer server;
ArGlobalFunctor3<char **, int, ArSocket *> testCB(&test);
if (!server.open(NULL, 7171, "password", true))
{
printf("Could not open server.\n");
exit(1);
}
server.addCommand("test", &testCB, "this simply prints out the command given on the server");
server.addCommand("test2", &testCB, "this simply prints out the command given on the server");
while (server.isOpen() && Aria::getRunning())
{
server.runOnce();
ArUtil::sleep(1);
}
server.close();
return 0;
}