I am trying to figure out how to make the equivalent of translating IPV4 using IPV6.
I am creating a non-blocking IPV6 UDP socket.
On the broadcast side, I literally just send the message "FF02 :: 1" to port 12346.
On the listener side, I found that I needed to join the group, so I did the following:
ipv6_mreq membership; memset( &membership.ipv6mr_multiaddr, 0, sizeof( in6_addr ) ); membership.ipv6mr_multiaddr.u.Word[0] = htons( 0xff02 ); membership.ipv6mr_multiaddr.u.Word[7] = htons( 0x0001 ); membership.ipv6mr_interface = 0; if( enable ) { if ( 0 != setsockopt( m_Socket, SOL_SOCKET, IPV6_JOIN_GROUP, (char*)&membership, sizeof( ipv6_mreq ) ) ) { DisplayError(); return false; } }
However, setsockopt always returns "WSAENOPROTOOPT". What for? Can someone help me with this? I have a complete loss.
Edit: I change the level to "IPPROTO_IPV6", but now I get "WSAEINVAL".
c ++ multicast ipv6 link-local
Goz
source share