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);
}