Multicast.c example details
Multicast details
#include <stdlib.h>
#include <stdio.h>
#include <stddef.h>
#include <inttypes.h>
#include <time.h>
#include <string.h>
#ifdef __cplusplus
extern "C" {
#endif
#pragma CODE_SECTION(udp_call_back , ".commontext")
#ifdef __cplusplus
}
#endif
#define MCAST_IP_ADDR "239.255.1.1"
#define MCAST_IP_ADDR2 "239.255.1.2"
#define MCAST_PORT 5555
#define MCAST_PORT2 5556
#define DSP_PORT 5031
#define CMD_LED_INIT 1
#define CMD_LED_ON 2
#define CMD_LED_OFF 3
{
data_length = net_recv_event_handler (so,
CPrintf);
if (data_length)
{
switch ( udp_data[0] )
{
break;
break;
break;
default :
break;
}
{
CPuts (
" New multicast data received\r\n");
CPrintf (
" Destination Address: %s\r\n",
inet_ntoa ( so-> mc_dest_addr, buffer));
CPrintf (
" Multicast Group Address: %s\r\n",
inet_ntoa ( so-> mc_group_addr, buffer));
CPrintf (
" Destination Port: %d\r\n", so-> mc_dest_port);
CPrintf (
" Source Multicast Port: %d\r\n", so-> mc_src_port);
}
else
{
" Destination Address: %s\r\n"
" Source Address: %s\r\n"
" Destination Port: %d\r\n"
" Source Port: %d\r\n\n",
so-> dest_port,
so-> src_port);
}
#ifdef USE_UART_CONTROL
udp_data[len] = 0x0;
#endif
}
}
#pragma CODE_SECTION(main , ".commontext");
{
int main_loop = 1;
{
}
CPrintf (
" *** timer %d mapped to CPU int %d ***\r\n",
{
}
CPuts (
" network startup time [sec]: ");
"%"PRId32".%03"PRId32"\r\n"
CPuts (
"\r\n Entering main loop ...\r\n");
while ( main_loop )
{
}
return (0);
}