src/network.c

changeset 56
11b57a15d11a
parent 55
54ea19938d57
child 59
3fa1de896666
equal deleted inserted replaced
55:54ea19938d57 56:11b57a15d11a
72 return getaddrinfo_intrnl(host, port, &(server->info)); 72 return getaddrinfo_intrnl(host, port, &(server->info));
73 } 73 }
74 74
75 int net_listen(Server *server) { 75 int net_listen(Server *server) {
76 listen(server->fd, 1); 76 listen(server->fd, 1);
77 Client* client = calloc(1, sizeof(Client)); 77 Client* client = malloc(sizeof(Client));
78 client->fd = -1; 78 client->fd = -1;
79 client->address_len = sizeof(client->address);
79 server->client = client; 80 server->client = client;
80 81
81 client->fd = accept(server->fd, 82 client->fd = accept(server->fd,
82 &(client->address), &(client->address_len)); 83 &(client->address), &(client->address_len));
83 84

mercurial