Ip Multicast - Hitachi CE50-10 Instruction Manual

Table of Contents

Advertisement

5. Configuring Software Environment
(A)
To change the IP address or network class, change the value of the bold underlined part.
(B)
Add an IPv6 address. You can omit leading zeros in the string of numeric values separated by colons. To
specify multiple IP addresses for one interface, add the IP address in the addresses key. Note that Netplan
does not support interface aliases.
2. Apply the IP addresses.
Run the following command or restart the unit.
$ sudo ip_duplichk_start
CAUTION
For the LAN port IP address of the development unit, specify the same IP address as the network address of the
LAN port connected to the unit that is to be set up.
Make sure that the IP address of the development unit differs from that of the unit that is to be set up. If these units
have the same IP address, the following error message appears.
KXDL010-W Ethernet adapter(interface-name) Duplicate IP address.
5.5.2 IP multicast
Class D addresses in the range from 224.0.0.0 to 239.255.255.255 are available for IP multicast communication.
(1) Sending data by using IP multicast
To send data by using IP multicast, you must create communication sockets, and then specify the following settings by
using a setsockopt system call.
1. Set the TTL (TimeToLive) value.
Specify the number of relays for multicast data for TTL. You can specify a value in the range from 0 to 255.
unsigned char
ipttl = 5;
setsockopt(sock, IPPROTO_IP, IP_MULTICAST_TTL, (char *)&ipttl, sizeof(ipttl));
2. Specify the IP multicast interface.
Before sending data by using IP multicast, specify the unit address.
unsigned int
ipmaddr = htonl(xxxxx);
setsockopt(sock, IPPROTO_IP, IP_MULTICAST_IF, (char *)&ipmaddr, sizeof(ipmaddr));
(2) Receiving data by using IP multicast
To receive data by using IP multicast, you must be a member of the IP multicast group. To join the IP multicast group,
specify the addresses as follows by using the setsockopt system call.
struct ip_mreq
memset((char *)&mreq, 0, sizeof(struct ip_mreq));
mreq.imr_multiaddr.s_addr = htonl(xxxxxx); /* Specify the IP multicast address (binary
format). */
mreq.imr_interface.s_addr = htonl(yyyyyy); /* Set the local unit address (binary forma
t). */
setsockopt(rcvsock, IPPROTO_IP, IP_ADD_MEMBERSHIP, (char *)&mreq, sizeof(mreq));
42
ipttl;
/* Set the TTL value. */
ipmaddr;
/* Set the local unit address (binary format). */
mreq;

Advertisement

Table of Contents
loading

Table of Contents