How to receive data over ethernet using LWIP, UDP

Im trying to send data to and from my computer and an STM32H745 over ethernet using LWIP and UDP. I have successfully configured the card and right now i can send data from the card to a python script running on the computer. However i dont understand how udp_recv works lwIP: UDP (nongnu.org) or how to recieve data with udp on lwip in general, and i cant find examples that do what i want to do. Where is the data being recieved? Should i even use udp_recv?

Below is the main code, just for refference.

const char* message = "a";

HAL_GPIO_TogglePin(GPIOE, GPIO_PIN_1); // orange

ip_addr_t PC_IPADDR;
IP_ADDR4(&PC_IPADDR, 192, 168, 1, 200);

u16_t port = 8000;

struct udp_pcb* my_udp = udp_new();

struct pbuf* udp_buffer = NULL;

/* Infinite loop */
for (;; )
{
	MX_LWIP_Process();
	HAL_GPIO_TogglePin(GPIOE, GPIO_PIN_1); // orange
	HAL_Delay(1000);

	udp_buffer = pbuf_alloc(PBUF_TRANSPORT, strlen(message), PBUF_RAM);
	if (udp_buffer != NULL)
	{
		memcpy(udp_buffer->payload, message, strlen(message));
		udp_sendto(my_udp, udp_buffer,&PC_IPADDR, port);
		pbuf_free(udp_buffer);
	}

	//udp_recv (struct udp_pcb *pcb, udp_recv_fn recv, void *recv_arg)

}

Any help is greatly appreciated!

Hello,

this forum is about MbedOS and related things.
So if you want to use MbedOS (it also use LWIP) then just visit its docs UDPSocket - API references and tutorials | Mbed OS 6 Documentation, owerwhise you probably need to find another place.

BR, Jan