I'm trying to port an ipv4 server/client to ipv6, but the compiler says SOCKADDR_IN6
is not declared in the scope. SOCKADDR_IN
is declared but not SOCKADDR_IN6
. <Winsock2.h>
is included.
Any one have any ideas why it would be undeclared?
I'm trying to port an ipv4 server/client to ipv6, but the compiler says SOCKADDR_IN6
is not declared in the scope. SOCKADDR_IN
is declared but not SOCKADDR_IN6
. <Winsock2.h>
is included.
Any one have any ideas why it would be undeclared?
From msdn:
struct in_addr6 {
u_char s6_addr[16]; /* IPv6 address */
};
struct sockaddr_in6 {
short sin6_family; /* AF_INET6 */
u_short sin6_port; /* Transport level port number */
u_long sin6_flowinfo; /* IPv6 flow information */
struct in_addr6 sin6_addr; /* IPv6 address */
u_long sin6_scope_id; /* set of interfaces for a scope */
};
From your question i see that:
SOCKADDR_IN6 != sockaddr_in6
Lowercase vs. Uppercase confusion?
You may also not have the latest version of winsock, i'm not sure how far back support for IPV6 was introduced, you may want to check if thats your problem.
Microsoft's documentation for sockaddr_in6
says that it is defined in the ws2tcpip.h
header, probably you need to include that.
On Linux you'd need different includes, sys/socket.h
and netinet/in.h
.