[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[lwip-users] udp broadcast reseive with RAW api
From: |
transistorman |
Subject: |
[lwip-users] udp broadcast reseive with RAW api |
Date: |
Tue, 17 Oct 2017 10:08:03 -0700 (MST) |
Hello,
I am trying to get my Atmel SAM E70 to receive broadcasts from my PC on
224.0.0.250. I am generating the udp packets on my PC with python and the
appear in Wireshark. I set up my code in udp_broadcast_rec_init() and I put
a breakpoint that never gets reached in the handler. What am I doing wrong?
In igmp_joingroup_netif I stepped and found my board IP address in
netif->ip_adddr and I found my broadcast address in groupaddr.
Thanks,
Frank
void udp_broadcast_rec_init(void){
struct udp_pcb *ptel_pcb;
err_t status ;
ptel_pcb = udp_new();
if ( ( status= udp_bind(ptel_pcb, IP_ADDR_ANY, 12345)) != ERR_OK) {
while(1);
};
//static const ip_addr_t v4group = IPADDR4_INIT_BYTES(224,0,0,251);
static const ip_addr_t v4group0 = IPADDR4_INIT_BYTES(224,0,0,250);
if (MACB_if.ip_addr.addr==0){
while(1);
}
if ((status = igmp_joingroup_netif(&MACB_if, &v4group0)) != ERR_OK) {
while(1);
};
/*register the callback*/
udp_recv(ptel_pcb, udp_broadcast_rec_callback, NULL);
}
void udp_broadcast_rec_callback(void *arg, struct udp_pcb *pcb, struct pbuf
*p, struct ip_addr *addr, u16_t port){
/*echo back the broadcast packet*/
if (p != NULL) {
udp_sendto(pcb, p, IP_ADDR_BROADCAST, 12344);
pbuf_free(p);
}
--
Sent from: http://lwip.100.n7.nabble.com/lwip-users-f3.html
- [lwip-users] udp broadcast reseive with RAW api,
transistorman <=