This commit is contained in:
tkarrass 2013-11-02 13:31:04 +01:00
parent d6101662f9
commit ac773aba50
2 changed files with 19 additions and 0 deletions

BIN
.test.c.swp Normal file

Binary file not shown.

19
net.c
View File

@ -28,6 +28,25 @@ void *get_in_addr(struct sockaddr *sa)
}
int run_server(const struct prog_info *pinfo) {
struct addrinfo hints, *servinfo;
int ret;
char portbuf[6];
memset(&hints, 0, sizeof(hints));
hints.ai_family = AF_UNSPEC;
hints.ai_socktype = SOCK_DGRAM;
sprintf(portbuf, "%d", pinfo->port);
if ((ret=getaddrinfo("0.0.0.0", portbuf, &hints, &servinfo)) != 0) {
fprintf(stderr, "getaddrinfo: %s\n", gai_strerror(rv));
return 1;
}
// ...
return 0;
}
int run_client(const struct prog_info *pinfo) {
struct addrinfo hints, *servinfo;
char portbuf[6];