lwip-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[lwip-users] How receive UDP broadcast with LwIP ?


From: Pekub
Subject: [lwip-users] How receive UDP broadcast with LwIP ?
Date: Thu, 7 Feb 2019 07:21:23 -0700 (MST)

Hello,

I have this problem. I need to receive UDP Broadcast, but The "callback"
function is never called. 

I use LwIP 2.0.3.

/*----- Default Value for IP_SOF_BROADCAST: 0 ---*/
#define IP_SOF_BROADCAST 1
/*----- Default Value for IP_SOF_BROADCAST_RECV: 0 ---*/
#define IP_SOF_BROADCAST_RECV 1
   
void udp_server_init(void)
{
     struct udp_pcb *upcb;
     err_t err;
       
     upcb = udp_new();
     ip_set_option(upcb, SOF_BROADCAST);
    
     if (upcb)
     {
         err = udp_bind(upcb, IP_ADDR_BROADCAST, 8000);
        
         if(err == ERR_OK)
         {
            udp_recv(upcb, udp_receive_callback, NULL);
         }
     }
}

void udp_receive_callback(void *arg, struct udp_pcb *upcb, struct pbuf *p,
const ip_addr_t *addr, u16_t port)
{
   HAL_GPIO_TogglePin(GPIOE, GPIO_PIN_2);
        
   pbuf_free(p);                // Free the p buffer
    
   //udp_transmit(upcb, addr, udp2_tx_data, udp2_tx_len);
}  

What is wrong ?

Peter



--
Sent from: http://lwip.100.n7.nabble.com/lwip-users-f3.html



reply via email to

[Prev in Thread] Current Thread [Next in Thread]