cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Voyager
Voyager
2,681 Views
Registered: ‎10-25-2012

How do callback functions "accept_callback" and "recv_callback" work in Lwip echo sever?

In LwIP echo sever application,  "accept_callback" and "recv_callback" can be called every time when  a connection is built and data is received.  Both of them are callback functions.

 

I try to understand hwo they work, so I read the callback function in Wikipedia. However, it still confuses me since the working approach of these two functions differ from the examples in Wikipedia

 

In the article of Wikipedia, it takes an example for callback in C:

 

int main() {
    PrintTwoNumbers(&rand);
    PrintTwoNumbers(&overNineThousand);
    PrintTwoNumbers(&meaningOfLife);
    return 0;
}

 

rand(), overNineThousand(), and meaningOfLife(), all these three functions are called when the program is excuted. However, in LwIP application, the command: "tcp_accept(pcb, accept_callback)" which is inside the "start_application()", setup the accept_callback. My question arises, why is just setup this function instead of calling it?

Is the difference resulted from property of these two functions "accept_callback" and "recv_callback" ?

 

Thanks very much.

 

 

 

0 Kudos
2 Replies
Highlighted
Voyager
Voyager
2,675 Views
Registered: ‎10-25-2012

Re: How do callback functions "accept_callback" and "recv_callback" work in Lwip echo sever?

Anybody can help?
0 Kudos
Highlighted
Voyager
Voyager
2,663 Views
Registered: ‎10-25-2012

Re: How do callback functions "accept_callback" and "recv_callback" work in Lwip echo sever?

Nobody know this?
0 Kudos