Skip to content
This repository has been archived by the owner on Apr 24, 2022. It is now read-only.

Add ipv6 support #8

Merged
merged 1 commit into from
Jan 6, 2013
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion config.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions server.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down