lwip-users
[Top][All Lists]
Advanced

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

Re: [lwip-users] dns_gethostbyname


From: Krzysztof Wesołowski
Subject: Re: [lwip-users] dns_gethostbyname
Date: Sun, 3 May 2015 20:15:59 +0200

Hi there,


What do you mean with "You can however post your callback to be executed on
lwip thread"?
What callback do you talk about, the callback function that is given as
parameter in the dns_gethostbyname? 
 
both "netconn api" and "socket api use "raw api" under the hood, those APIs handle inter thread communication for you.

You can do something similar if you need to execute code on tcpip_thread from your code. Just use function:

tcpip_callback_with_block

This function simply takes function pointer, void * argument (to pass additional context to your function if it is needed), and uses RTOS mechanisms to execute in on tcpip thread (extra argument determines if current thread will block until execution on tcpip thread completes).

You need to prepare your own functions:
- one responsible for starting request, which will call dns_gethostbyname and will be passed to tcpip_callback_with_block,
- one responsible for handling result of request, passed to dns_gethostbyname. This function will be called by dns code on tcpip thread when requests completes.

Unfortunately I do not have sample at hand.

Regards,
Krzysztof Wesołowski

reply via email to

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