diff --git a/config.h b/config.h index 282594d..0d17686 100644 --- a/config.h +++ b/config.h @@ -4,7 +4,7 @@ #include "encrypt.h" // This is the IP address server will be used to accept new connection -#define SERVER_LISTEN "0.0.0.0" +#define SERVER_LISTEN "::0" // This is the port server will be used to accept new connection #define SERVER_PORT 8888 diff --git a/server.c b/server.c index 9848cf6..61d418b 100644 --- a/server.c +++ b/server.c @@ -568,13 +568,13 @@ int main(int argc, char *argv[]) uv_loop_t *loop = uv_default_loop(); uv_tcp_t listener; - struct sockaddr_in addr = uv_ip4_addr(server_listen, server_port); + struct sockaddr_in6 addr = uv_ip6_addr(server_listen, server_port); n = uv_tcp_init(loop, &listener); if (n) SHOW_UV_ERROR_AND_EXIT(loop); - n = uv_tcp_bind(&listener, addr); + n = uv_tcp_bind6(&listener, addr); if (n) SHOW_UV_ERROR_AND_EXIT(loop);