[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
(usagi-users 02736) multicast to ff05::/16
- To: <usagi-users@xxxxxxxxxxxxxx>
- Subject: (usagi-users 02736) multicast to ff05::/16
- From: Takashi Hibi <hibi665@xxxxxxx>
- Date: Tue, 06 Jan 2004 13:09:35 +0900
- Reply-to: usagi-users@xxxxxxxxxxxxxx
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[])
{
addrinfo hint;
addrinfo *AI;
int s;
int ret;
char buf[64];
memset(&hint, 0, sizeof(hint));
hint.ai_family = AF_INET6;
hint.ai_socktype = SOCK_DGRAM;
ret = getaddrinfo(argv[1], argv[2], &hint, &AI);
if (ret < 0) {
printf("%s\n", gai_strerror(ret));
return -1;
}
s = socket(AF_INET6, SOCK_DGRAM, 0);
ret = sendto(s, buf, sizeof(buf), 0, (sockaddr *)paddr, sizeof(*paddr));
if (ret < 0) {
perror("sendto");
}
freeaddrinfo(AI);
return 0;
}
~