testserver.c 615 Bytes
#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: