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?
Microsoft's documentation for
sockaddr_in6
says that it is defined in thews2tcpip.h
header, probably you need to include that.On Linux you'd need different includes,
sys/socket.h
andnetinet/in.h
.I have currently found
SOCKADDR_IN6
definition inws2ipdef.h
header (Visual Studio 2008). However, as said in a comment below, MS Docs states that this header should never be used directly (useWs2tcpip.h
instead).From msdn:
From your question i see that:
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.