lwip-users
[Top][All Lists]
Advanced

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

RE: [lwip-users] DNS question


From: Kieran Mansley
Subject: RE: [lwip-users] DNS question
Date: Fri, 14 Aug 2009 16:41:06 +0100

On Fri, 2009-08-14 at 10:20 -0500, Chuck Kuecker wrote:
> Hi, Kieran,
> 
> My impression was that dns_gethostbyname() would return ERR_OK if it did
> not encounter anything fatal, but would actually set up the DNS query
> for transmission in the background, so that dns_gethostbyname() returns
> immediately, and would only have good information if the resolution was
> already in the DNS tables.

Take a look at the source.  If it already knows the answer it fills it
in and returns ERR_OK.  Otherwise it will work asynchronously and call
the specified callback when it knows the answer (or error, or timeout).

> Since I am booting the processor every time I
> need to resolve DNS, I can't expect a previously resolved IP to be in
> memory.

So then it will always work asynchronously.

> The callback always gets called sometime after dns_gethostbyname() is
> called. I use the argument parameter to let me know which URL I have
> been working with. In case of a DNS failure, I need to abort further
> processing.

So if you get an error in your callback set some global state that you
check before doing any processing, and abort the further processing if
that state is set.

Kieran





reply via email to

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