lwip-users
[Top][All Lists]
Advanced

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

Re: [lwip-users] "netconn_bind" broken for UDP connections in LwIP 1.4.0


From: Sylvain Rochet
Subject: Re: [lwip-users] "netconn_bind" broken for UDP connections in LwIP 1.4.0?
Date: Wed, 2 May 2012 18:15:56 +0200
User-agent: Mutt/1.5.21 (2010-09-15)

Hi Marco,

On Wed, May 02, 2012 at 05:45:55PM +0200, Marco Jakobs wrote:
> Hi,
> 
> i have some UDP transmissions where i need to definitely set the
> source port (my transmission port) to a given value!

Maybe this is pretty old for 1.4.0, but it may help you.

I wrote several years ago a NTP server, NTP uses the same port for source 
and destination in most cases, which is 123/UDP.

This is what I used:


Bind, so use source port = 123:

udp_bind(n->udp_socket, IP_ADDR_ANY, 123);
udp_recv(n->udp_socket, ntp_net_recv_callback, n);


Send to using port 123 as destination, on the same socket, so source and 
destination port = 123:

udp_sendto(n->udp_socket, pkt_buf, ntpserver, 123);


Sylvain

Attachment: signature.asc
Description: Digital signature


reply via email to

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