UDP server callback

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

UDP server callback

Peter Kubelka

Hello,

I created UDP server with LwIP stack on STM32F407. I tried example udp_echo _server. It works.

Now I need send from server my own answer data in callback function.

The program hangs in callback function.

void udp_echoserver_receive_callback(void *arg, struct udp_pcb *upcb, struct pbuf *p, const ip_addr_t *addr, u16_t port)

{

      

   unsigned char buffer[80] = "my name is xxxxxxx";

 

    p->payload = buffer;

    p->len = p->tot_len = 20;

 

    /* Connect to the remote client */

    udp_connect(upcb, addr, UDP_CLIENT_PORT);

 

    /* Tell the client that we have accepted it */

    udp_send(upcb, p);

 

 

    /* free the UDP connection, so we can accept new clients */

    udp_disconnect(upcb);

 

 

    /* Free the p buffer */

    pbuf_free(p);

}

What is wrong ?

Is somewhere on web LwIP stack guide?

 Thank you

 

Peter

 

 


_______________________________________________
lwip-users mailing list
[hidden email]
https://lists.nongnu.org/mailman/listinfo/lwip-users