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: Surya Chaitanya
Subject: Re: [lwip-users] UDP bind error due to address and port reuse
Date: Tue, 13 Dec 2016 11:28:35 +0530

Hi Dirk,

I tried out the few lines of code like you suggested. It works. However, what I 
don't understand is how it works, i.e., how the port parameter in the function 
is  
the port sending the reply. Could you plz. explain. Thank You.

Regards,
Surya

On Wed, 7 Dec 2016 11:43:59 +0100, Dirk Ziegelmeier wrote
> 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
> <http://www.nongnu.org/lwip/2_0_0/structudp__pcb.html> *pcb, struct pbuf
> <http://www.nongnu.org/lwip/2_0_0/structpbuf.html> *p, const ip_addr_t
> 
<http://www.nongnu.org/lwip/2_0_0/group__ipaddr.html#ga44f9ada14c65d17aecf802d82eb27
3c5>
> *addr, u16_t port)
> {
>    [create new pbuf with response]
>    udp_sendto(pcb, response_pbuf, addr, port);
> [UTF-8?]​}
> 
> [UTF-8?]​Dirk
> [UTF-8?]​


Disclaimer:
----------
This email and any files transmitted with it are confidential and intended 
solely 
for 
the use of the individual or entity to whom they are addressed.  If you are 
not the 
intended recipient you are notified that disclosing, copying, distributing or 
taking 
any 
action in reliance on the contents of this information is strictly prohibited. 
The 
sender does not accept liability for any errors or omissions in the contents of 
this 
message, which arise as a result of e-mail transmission.

--
Open WebMail Project (http://openwebmail.org)




reply via email to

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