No udp multicast receive with Kinetis SDK 2.1.0 and FRDM-K66F

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

No udp multicast receive with Kinetis SDK 2.1.0 and FRDM-K66F

1,889件の閲覧回数
ReySinTrono
Contributor I

Hello,

 

Any example over receive udp multicast with Kinetis SDK 2.1.0 and FRDM-K66F?

 

I can not make it work:

 

 

 

static void udpecho_thread(void *arg)
{
struct netconn *conn;
struct netbuf *buf;
char buffer[4096];
err_t err;
LWIP_UNUSED_ARG(arg);

#if LWIP_IPV6
conn = netconn_new(NETCONN_UDP_IPV6);
netconn_bind(conn, IP6_ADDR_ANY, 7);
#else /* LWIP_IPV6 */
conn = netconn_new(NETCONN_UDP);
netconn_bind(conn, IP_ADDR_ANY, 5000);
#endif /* LWIP_IPV6 */
LWIP_ERROR("udpecho: invalid conn", (conn != NULL), return;);

#if LWIP_IGMP /* Only for testing of multicast join*/
{
#include "lwip\netif.h"

ip4_addr_t multiaddr;
IP4_ADDR(&multiaddr, 224, 5, 6, 7);

err = netconn_join_leave_group(conn, &multiaddr, &netif_default->ip_addr, NETCONN_JOIN);
LWIP_ERROR("udpecho: join group is failed", (err == ERR_OK), return;);
}
#endif

while (1) {
err = netconn_recv(conn, &buf);
if (err == ERR_OK) {
/* no need netconn_connect here, since the netbuf contains the address */
if(netbuf_copy(buf, buffer, sizeof(buffer)) != buf->p->tot_len) {
LWIP_DEBUGF(LWIP_DBG_ON, ("netbuf_copy failed\n"));
} else {
buffer[buf->p->tot_len] = '\0';
err = netconn_send(conn, buf);
if(err != ERR_OK) {
LWIP_DEBUGF(LWIP_DBG_ON, ("netconn_send failed: %d\n", (int)err));
} else {
LWIP_DEBUGF(LWIP_DBG_ON, ("got %s\n", buffer));
}
}
netbuf_delete(buf);
}
}
}

 

Thanks.

ラベル(1)
0 件の賞賛
返信
2 返答(返信)

1,497件の閲覧回数
elisabeth_wilhe
Contributor I

Hey Juande,

We are facing the same error but we don't have any idea what we screwed up on our setup. Could you quickly tell us what the problem was with your setup?

Thx in advance.

0 件の賞賛
返信

1,497件の閲覧回数
ReySinTrono
Contributor I

Sorry. The problem was my PC. This work.

Thanks.

0 件の賞賛
返信