Takashi,
I didn't see a response to this. I'm guessing this
isn't the real code you're using, because I didn't see "paddr"
declared or initialized in what you quoted. Also, though I haven't
checked, the man page says "non zero", not "negative" as an
error value for getaddrinfo()-- if all error codes are negative, it
won't affect your code, but a positive value would indicate
an error but not be caught by the code you quoted.
Also, to select the interface you want to send the packet
on, you'll want to set the scope_id field in the sockaddr_in6
structure to be the interface index. Something like:
paddr.sin6_scope_id = if_nametoindex("eth0");
(or whatever other method you're using to get the index). Assuming
"paddr" is a sockaddr_in6 and points to the sockaddr you got from
the getaddrinfo() call.
Multicast addresses, like (remote) link-local addresses, don't
identify which interface you intend, since the same prefix can appear
on any interface, which is why you'll want to set the scope_id to
send it out a particular one of your choosing.
+-DLS
Please respond to usagi-users@xxxxxxxxxxxxxx
To: <usagi-users@xxxxxxxxxxxxxx>
cc:
Subject: (usagi-users 02736) multicast to ff05::/16
Hi all,
I have a simple question.
Is it possible to send multicast packet to ff05::/16 network?
The following is a simple test code.
If ff05::x (x=1,2,..) is specified as argv[1], sendto() fails.
The error message is "Cannot assign requested address".
But it works on FreeBSD and Windows
What is wrong?
Regards,
Takashi Hibi
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <netdb.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
int main(int argc, char *argv[])
{