lwip-users
[Top][All Lists]
Advanced

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

Re: [lwip-users] UDP bind error due to address and port reuse


From: Dirk Ziegelmeier
Subject: Re: [lwip-users] UDP bind error due to address and port reuse
Date: Wed, 7 Dec 2016 11:43:59 +0100

Use one UDP PCB, bind it to IPADDR_ANY and port x.

Use udp_sendto() to send to any IP/port combination.
http://www.nongnu.org/lwip/2_0_0/group__udp__raw.html

You get the src address/port of any request in your receive callback:

void my_udp_recv_fn (void *arg, struct udp_pcb *pcb, struct pbuf *p, const ip_addr_t *addr, u16_t port)
{
   [create new pbuf with response]
   udp_sendto(pcb, response_pbuf, addr, port);
​}

​Dirk


reply via email to

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