Beginning to explicitly support IPv6

This commit is contained in:
Pierre Pronchery 2012-11-21 20:00:25 +01:00
parent 2276eab4cb
commit 416643c52d
3 changed files with 8 additions and 1 deletions

View File

@ -42,6 +42,11 @@
# define close(fd) closesocket(fd)
#endif
/* for tcp4 and tcp6 */
#ifndef TCP_FAMILY
# define TCP_FAMILY AF_INET
#endif
/* TCP */
/* private */
@ -200,7 +205,7 @@ static int _init_address(char const * name, struct sockaddr_in * sa)
/* check for errors */
if(l < 0)
return -1;
sa->sin_family = AF_INET;
sa->sin_family = TCP_FAMILY;
sa->sin_port = htons(l);
memcpy(&sa->sin_addr, he->h_addr_list[0], sizeof(sa->sin_addr));
return 0;

View File

@ -15,4 +15,5 @@
#define TCP_FAMILY AF_INET
#include "tcp.c"

View File

@ -15,4 +15,5 @@
#define TCP_FAMILY AF_INET6
#include "tcp.c"