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 |