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: Noam Weissman
Subject: Re: [lwip-users] UDP bind error due to address and port reuse
Date: Sun, 11 Dec 2016 09:10:18 +0000

Hi Suraya,

Sure you can do it. UDP is connection-less mode. That means that you can accept 
messages from anyone.
You can either filter the messages by port like Dirk suggested or by ID as you 
said you can use.

The only enhancement that I can suggest is creating some queueing mechanism and 
process the data
Inside the receive function. If you get lots of messages in a burst this is 
better.

BR,
Noam.

-----Original Message-----
From: lwip-users [mailto:address@hidden On Behalf Of Surya Chaitanya
Sent: Friday, December 09, 2016 7:00 AM
To: Mailing list for lwIP users
Cc: address@hidden; address@hidden
Subject: Re: [lwip-users] UDP bind error due to address and port reuse

Hi Noam,

On the recipients side, they are using the same port for send and receive. And 
yeah, like you mentioned, we do have a way(an ID) to recognize from which port, 
the data has arrived. 

What I would like to know is after sending 5 messages from the application at 
the embedded side using one port and one UDP PCB, can I listen to all the 5 
ports of the destination using the same one UDP PCB? Thanks.

Regards,
Surya 

On Wed, 7 Dec 2016 10:56:08 +0000, Noam Weissman wrote
> Hi,
> 
> Dirk, if the application is creating a different port on every reply 
> you cannot rely on that.
> 
> You must have control over the data
> 
> Surya,
> 
> Yes you can listen on a single UDP but you need to get some kind of 
> data that will let you know who
> 
> Responded.
> 
> If you have a processing issue, meaning you send 5 messages and 
> applications send the replies
> 
> more or less at the same time, you may need to first to add the 
> received data to some kind of
> 
> temporary buffering mechanism and in the background process one 
> message at a time.
> 
> The above buffering mechanism ensures that you do not loos any 
> [UTF-8?]data…
> 
> This is how I would have done it.
> 
> BR,
> 
> Noam.
> 
> From: lwip-users [mailto:address@hidden 
> On Behalf Of Dirk Ziegelmeier
 Sent: Wednesday, December 07, 2016 12:44 PM
 To: 
> Mailing list for lwIP users
 Subject: Re: [lwip-users] UDP bind error due to 
> address and port reuse
> 
> 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#ga44f9ada14c65d17aecf8
02d82eb273c5> *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)


_______________________________________________
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]