I am trying to set-up a private ipv6 network with two windows-7 machines for tesing my application. I have written a sample code to test the socket apis. I have created an IPv6
If you're using a link-local IPv6 address, you probably need to set the sin6_scope_id
field in your sockaddr_in6
structure to indicate which interface you want to listen on. A link-local address is ambiguous, since every interface must have a link-local address assigned, and they all use the same prefix. (fe80::/64
)
You should probably bind()
your listen socket to the unspecified address (all-zeroes or ::
) so this isn't an issue, but it will still be a problem for the sending side. If you don't specify the sin6_scope_id
, the system won't know which interface to send the packet on.
To avoid the issue, it would be best to set up an IPv6 router that does router advertisements, so you can get global unicast (or, at a minimum, unique local) addresses.