|
|
@ -34,7 +34,7 @@ int create_addr(int network, char* address, int port,struct sockaddr* dest) {
|
|
|
|
listen_address.sin_port = htons(port);
|
|
|
|
listen_address.sin_port = htons(port);
|
|
|
|
inet_pton(AF_INET,address,&listen_address.sin_addr);
|
|
|
|
inet_pton(AF_INET,address,&listen_address.sin_addr);
|
|
|
|
memcpy(dest,&listen_address,sizeof(listen_address));
|
|
|
|
memcpy(dest,&listen_address,sizeof(listen_address));
|
|
|
|
return;
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
|
|
|
|
} else if (network == 6) {
|
|
|
|
} else if (network == 6) {
|
|
|
|
struct sockaddr_in6 listen_ipv6;
|
|
|
|
struct sockaddr_in6 listen_ipv6;
|
|
|
@ -42,7 +42,7 @@ int create_addr(int network, char* address, int port,struct sockaddr* dest) {
|
|
|
|
listen_ipv6.sin6_port = htons(port);
|
|
|
|
listen_ipv6.sin6_port = htons(port);
|
|
|
|
inet_pton(AF_INET6,address,&listen_ipv6.sin6_addr);
|
|
|
|
inet_pton(AF_INET6,address,&listen_ipv6.sin6_addr);
|
|
|
|
memcpy(dest,&listen_ipv6,sizeof(listen_ipv6));
|
|
|
|
memcpy(dest,&listen_ipv6,sizeof(listen_ipv6));
|
|
|
|
return;
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
return -202;
|
|
|
|
return -202;
|
|
|
|