Sockaddr_in6 not announced?

I am trying to migrate the ipv4 server / client to ipv6, but the compiler says it is SOCKADDR_IN6not declared in the scope. SOCKADDR_INdeclared, but not SOCKADDR_IN6. <Winsock2.h>.

Does anyone have any idea why it was not announced?

+3
source share
3 answers

The Microsoft documentation forsockaddr_in6 says that it is defined in the header ws2tcpip.h, perhaps you need to include this.

On Linux, you will need different options, sys/socket.hand netinet/in.h.

+8
source

SOCKADDR_IN6 ws2ipdef.h (Visual Studio 2008). , , MS Docs , ( Ws2tcpip.h).

+1

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 */
   };  

:

SOCKADDR_IN6 != sockaddr_in6

?
winsock, , IPV6, , .

0

Source: https://habr.com/ru/post/1758800/


All Articles