-
Notifications
You must be signed in to change notification settings - Fork 0
/
wserv.c
48 lines (37 loc) · 913 Bytes
/
wserv.c
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
39
40
41
42
43
44
45
46
#include <stdio.h>
#include <stdlib.h>
#include <strings.h>
#include <fcntl.h>
#include <unistd.h>
#include <arpa/inet.h>
#include <sys/socket.h>
#include <netdb.h>
#include <sys/types.h>
#include "ods_server.h"
#include "wclient.h"
#include "poller.h"
void serve(struct ods_server_params *params);
int main(int argc, char *argv[]) {
// Parse options from command line
struct ods_server_params params;
bzero(¶ms, sizeof(params));
params.addr = "127.0.0.1";
if (argc > 1) {
params.service = argv[1];
}
else {
params.service = "http";
}
params.qlen = 10;
params.max_clients = 100;
serve(¶ms);
exit(0);
}
void serve(struct ods_server_params *params) {
struct ods_server server;
if (ods_server_init(&server, params) < 0) {
perror("Could not initialize server");
exit(1);
}
ods_server_loop(&server);
}