-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathMain.c
More file actions
34 lines (25 loc) · 690 Bytes
/
Main.c
File metadata and controls
34 lines (25 loc) · 690 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
#include "Slim.h"
#include "SocketServer.h"
#include "SlimConnectionHandler.h"
#include "TcpComLink.h"
#include <stdlib.h>
#include <string.h>
Slim * slim;
int connection_handler(int socket)
{
int result = 0;
TcpComLink * comLink = TcpComLink_Create(socket);
result = Slim_HandleConnection(slim, (void*)comLink, &TcpComLink_send, &TcpComLink_recv);
TcpComLink_Destroy(comLink);
return result;
}
int main(int ac, char** av)
{
slim = Slim_Create();
SocketServer* server = SocketServer_Create();
SocketServer_register_handler(server, &connection_handler);
int result = SocketServer_Run(server, av[1]);
SocketServer_Destroy(server);
Slim_Destroy(slim);
return result;
}