The arguments to the function are the *source* IP/Port tuple of the request.
If you use udp_sendto() then the the *reply *packet has
- Source IP: IP of your lwIP device
- Source port: Port in your lwIP device ("x")
- Destination IP: source IP of the request = addr parameter of function
- Destination port: source port of the request = port parameter of the
function
Dirk
On Tue, Dec 13, 2016 at 6:58 AM, Surya Chaitanya <[email protected]> wrote:
> 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)
>
>
> _______________________________________________
> lwip-users mailing list
> [email protected]
> https://lists.nongnu.org/mailman/listinfo/lwip-users
>
_______________________________________________
lwip-users mailing list
[email protected]
https://lists.nongnu.org/mailman/listinfo/lwip-users