testserver.c
615 Bytes
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
28
29
30
31
32
33
34
35
36
37
38
#include <stdio.h>
#include <socket.h>
#include <string.h>
#include "server.h"
#include "logger.h"
#include "signalHandling.h"
#include "interface/class.h"
static void
read_hook(const char * _buffer, size_t size)
{
char buffer[1025];
memset(buffer, 0, 1025);
snprintf(buffer, 1025>size? size : 1024, "%s", _buffer);
printf("%s\n", buffer);
}
int
main()
{
Logger logger = new(LoggerStderr, LOGGER_INFO);
Server server = new(Server, logger, 11212, SOMAXCONN);
server->read_hook = read_hook;
init_signals();
serverRun(server);
delete(&server);
delete(&logger);
return 0;
}
// vim: set ts=4 sw=4: