Beginning to explicitly support IPv6
This commit is contained in:
parent
2276eab4cb
commit
416643c52d
|
@ -42,6 +42,11 @@
|
||||||
# define close(fd) closesocket(fd)
|
# define close(fd) closesocket(fd)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/* for tcp4 and tcp6 */
|
||||||
|
#ifndef TCP_FAMILY
|
||||||
|
# define TCP_FAMILY AF_INET
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
/* TCP */
|
/* TCP */
|
||||||
/* private */
|
/* private */
|
||||||
|
@ -200,7 +205,7 @@ static int _init_address(char const * name, struct sockaddr_in * sa)
|
||||||
/* check for errors */
|
/* check for errors */
|
||||||
if(l < 0)
|
if(l < 0)
|
||||||
return -1;
|
return -1;
|
||||||
sa->sin_family = AF_INET;
|
sa->sin_family = TCP_FAMILY;
|
||||||
sa->sin_port = htons(l);
|
sa->sin_port = htons(l);
|
||||||
memcpy(&sa->sin_addr, he->h_addr_list[0], sizeof(sa->sin_addr));
|
memcpy(&sa->sin_addr, he->h_addr_list[0], sizeof(sa->sin_addr));
|
||||||
return 0;
|
return 0;
|
||||||
|
|
|
@ -15,4 +15,5 @@
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#define TCP_FAMILY AF_INET
|
||||||
#include "tcp.c"
|
#include "tcp.c"
|
||||||
|
|
|
@ -15,4 +15,5 @@
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#define TCP_FAMILY AF_INET6
|
||||||
#include "tcp.c"
|
#include "tcp.c"
|
||||||
|
|
Loading…
Reference in New Issue
Block a user