Multicast Receiver
Posted: Tue Nov 14, 2017 10:53 pm
I have the xCORE-200 Explorer kit and I'm trying to receive a multicast message that presents on 224.224.24.23:11007.
I've been using xtcp to send/receive in a server/client model but I'm at a loss if its possible to use the same library for receiving a multicast message.
At the moment it's really a guess to me as to why there would be function for joining a multicast group but not include a port to send/receive messages. I'm currently doing the following, though obviously it's not working.
Are there any examples of receiving multicast message using xtcp or any tips?
xtcp_ipaddr_t ip_add = {224,224,24,23};
int port_num = 11007;
xtcp_join_multicast_group(c_xtcp, ip_add);
//xtcp_listen(c_xtcp, port_num, XTCP_PROTOCOL_UDP);
while (1)
{
select
{
// Respond to an event from the tcp server
case xtcp_event(c_xtcp, conn):
switch (conn.event)
{
case XTCP_IFUP:
xtcp_connect(c_xtcp,port_num,ip_add, XTCP_PROTOCOL_UDP);
break;
case XTCP_IFDOWN:
break;
case XTCP_NEW_CONNECTION:
if (responding_connection.id == INIT_VAL)
responding_connection = conn;
else
xtcp_close(c_xtcp, conn);
break;
case XTCP_RECV_DATA:
response_len = xtcp_recv_count(c_xtcp, rx_buffer, RX_BUFFER_SIZE);
rx_buffer[response_len] = 0;
............
I've been using xtcp to send/receive in a server/client model but I'm at a loss if its possible to use the same library for receiving a multicast message.
At the moment it's really a guess to me as to why there would be function for joining a multicast group but not include a port to send/receive messages. I'm currently doing the following, though obviously it's not working.
Are there any examples of receiving multicast message using xtcp or any tips?
xtcp_ipaddr_t ip_add = {224,224,24,23};
int port_num = 11007;
xtcp_join_multicast_group(c_xtcp, ip_add);
//xtcp_listen(c_xtcp, port_num, XTCP_PROTOCOL_UDP);
while (1)
{
select
{
// Respond to an event from the tcp server
case xtcp_event(c_xtcp, conn):
switch (conn.event)
{
case XTCP_IFUP:
xtcp_connect(c_xtcp,port_num,ip_add, XTCP_PROTOCOL_UDP);
break;
case XTCP_IFDOWN:
break;
case XTCP_NEW_CONNECTION:
if (responding_connection.id == INIT_VAL)
responding_connection = conn;
else
xtcp_close(c_xtcp, conn);
break;
case XTCP_RECV_DATA:
response_len = xtcp_recv_count(c_xtcp, rx_buffer, RX_BUFFER_SIZE);
rx_buffer[response_len] = 0;
............