lwip-users
[Top][All Lists]
Advanced

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

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


From: Dirk Ziegelmeier
Subject: Re: [lwip-users] How receive UDP broadcast with LwIP ?
Date: Thu, 7 Feb 2019 15:41:39 +0100

Did you configure your MAC to receive multicasts/boradcasts? lwIP cannot do this!

Ciao
Dirk


On Thu, Feb 7, 2019 at 3:39 PM Pekub <address@hidden> wrote:
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

_______________________________________________
lwip-users mailing list
address@hidden
https://lists.nongnu.org/mailman/listinfo/lwip-users

reply via email to

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