lwip-users
[Top][All Lists]
Advanced

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

[lwip-users] Basic UDP send not working.


From: Luciano Moretti
Subject: [lwip-users] Basic UDP send not working.
Date: Tue, 2 Mar 2021 15:25:58 -0600

Hello:
I'm trying to send a generic UDP packet on a STM32F407 chip.
The HTTP server works, so the hardware is working. I can load the default page on my workstation no issue.

I'm trying to just send a UDP packet to a specific IP & Port. LwIP doesn't give an error but the packet doesn't show up in Wireshark. 

Code:

bool sendUDP(ip4_addr_t DestinationIP, uint16_t port, uint8_t *data, uint16_t length)
{
err_t err;
pbuf *p;

udp_pcb *upcb = udp_new();

// TODO: Clean up error handling here.
err = udp_connect( upcb, &DestinationIP, port );
p = pbuf_alloc( PBUF_TRANSPORT, length, PBUF_RAM );
memcpy(p->payload, data, length);
err = udp_send( upcb, p );
udp_disconnect( upcb );
pbuf_free(p);
udp_remove(upcb);
return (ERR_OK == err);
}

reply via email to

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