File: testserv.cc

package info (click to toggle)
atom4 4.1-1
  • links: PTS
  • area: main
  • in suites: sarge
  • size: 664 kB
  • ctags: 947
  • sloc: cpp: 4,451; makefile: 52; sh: 45; perl: 6
file content (27 lines) | stat: -rw-r--r-- 579 bytes parent folder | download | duplicates (7)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
/*
 * Fake Atom-4 server to test server code
 */

#include <stdio.h>
#include <exception.h>			// prog/lib version
#include "game.h"
#include "server.h"


#define SERV_PORT		4704

int main() {
  try {
    int exitflag=0;
    eventloop mainloop;
    atom4local game(16,16);
    server gamesrv(&game, &mainloop, SERV_PORT, server::ALLOW_OBSERVERS);

    fprintf(stderr, "Server initialized, waiting for connections\n");
    mainloop.run(&exitflag);
    fprintf(stderr, "Server exited\n");
  } catch(exception &e) {
    fprintf(stderr, "Caught exception: %s\n", e.message());
  }
}