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

Commit

Permalink
add ipv6 support
Browse files Browse the repository at this point in the history
  • Loading branch information
madeye committed Jan 6, 2013
1 parent 6421d90 commit 9c3caca
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
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

0 comments on commit 9c3caca

Please sign in to comment.