[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[lwip-users] Very basic query regarding udp_sendto
From: |
Hemant Kapoor |
Subject: |
[lwip-users] Very basic query regarding udp_sendto |
Date: |
Tue, 7 Apr 2020 05:15:10 -0700 (MST) |
Hello,
I am a newbie to networking and managed to port lwip stack to LPC17xx
controller runninf freertos.
I have requirement to send UDP data to a static destination IP Address.
I have a task which tries to send a UDP Packet every one second.
When I send data via broadcast, it works.
udp_sendto(pcb, pb,IP_ADDR_BROADCAST,1235)
Also from my PC if I ping to my board it all works fine
But if I try to send data to a specific ip address (that of my PC) then it
doesn;t work
udp_sendto(pcb, pb,&destinationAddress,1235)
Also I niotice that ping stop working.
If I follow existing example of UDP Echo, i.e. connect to an IP and port for
UDP
udp_connect(pcb, &destinationAddress, pc_port);
and in callback of receive message, I send UDP packet it works.
udp_recv(pcb, udp_echo_recv, NULL);
In my call back
static void udp_echo_recv(void *arg, struct udp_pcb *pcb, struct pbuf *p,
struct ip_addr *addr, u16_t port)
{
udp_send(pcb, p);
pbuf_free(p);
}
I thought UDP is connectionless and sending UDP Data to a given IP Address
and Port shuld simply work.
Can you please let me know what I am doing wrong here.
--
Sent from: http://lwip.100.n7.nabble.com/lwip-users-f3.html
- [lwip-users] Very basic query regarding udp_sendto,
Hemant Kapoor <=