Home/Support/Support Forum/ipv6 multicast on NET+OS 7.5 / Connect Me 9210
Welcome to Digi Forum, where you can ask questions and receive answers from other members of the community.

ipv6 multicast on NET+OS 7.5 / Connect Me 9210

0 votes
Support the NET+OS Version 7.5.2.2
multicast for ipv6?

I try this multicast send example,
the return value from sendto(..) ist always -1.

Thanks for any suggestions.



struct addrinfo hint, * info;

memset( &hint, 0, sizeof( hint ) );

hint.ai_family = AF_INET6;
hint.ai_socktype = SOCK_DGRAM;
hint.ai_protocol = IPPROTO_UDP;
hint.ai_flags |= AI_NUMERICHOST;

int err = getaddrinfo( "ff08::1", NULL, &hint, &info );

if( err != 0 ) {
perror( "getaddrinfo" );
return 0;
}

struct sockaddr_in6 * ipv6_addr = (struct sockaddr_in6*)info->ai_addr;
ipv6_addr->sin6_port = htons( 65535 );
ipv6_addr->sin6_scope_id = 8; //same result with 0
s = socket( AF_INET6, SOCK_DGRAM, 0 );

int multicastTTL = 1;
if (setsockopt(s, IPPROTO_IPV6, IPV6_MULTICAST_HOPS,
&multicastTTL, sizeof(multicastTTL)) < 0)
{
perror("setsockopt failed");
exit( 1 );
}

for( ; ; ) {
char data[6];
int e_nr;

scanf( "%5s", data );
data[5] = '\0';
printf( "Sending %s\n", data );
if( (e_nr = sendto( s, data, 5, 0, info->ai_addr, info->ai_addrlen )) != 5 ) {
printf( "Error sending %d\n", e_nr);
}

if( strcmp( data, "exitt" ) == 0 ) {
break;
}
}

close( s );
asked Oct 24, 2017 in NET+OS by Josef New to the Community (3 points)

Please log in or register to answer this question.

2 Answers

0 votes
what address are you sending to? TCP? UDP?
have you tried something along those lines:
https://cboard.cprogramming.com/networking-device-communication/67469-ipv6-multicast-example-code.html
?
answered Oct 25, 2017 by LeonidM Veteran of the Digi Community (2,891 points)
0 votes
With this example i have the same result.
Now i wait for our new ipv6 network.
Thanks for the suggestion.
answered Nov 2, 2017 by Josef New to the Community (3 points)
...