I'm trying to figure out how to do the equivalent of an IPV4 broadcast using IPV6.
I'm creating a non-blocking IPV6 UDP socket.
From the side broadcasting i'm literally just doing a sendto "FF02::1" on port 12346.
On the listen side I discovered I need 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". Why? Can anyone help me on this one? I'm at a complete loss.
Edit: I change the level to "IPPROTO_IPV6" but now I get a "WSAEINVAL".