lwip-users
[Top][All Lists]
Advanced

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

RE: [lwip-users] DNS question


From: Chuck Kuecker
Subject: RE: [lwip-users] DNS question
Date: Fri, 14 Aug 2009 11:06:08 -0500

Hi, Kieran,

Asynchronously - that's the word. I have a state machine running that
does other stuff while DNS is thinking.

How do I know there's been an error? The only data that I know that the
callback gets from the DNS lookup is the argument I set on the call to
dns_gethostbyname(). Did I miss something?

Chuck

-----Original Message-----
From: address@hidden
[mailto:address@hidden On
Behalf Of Kieran Mansley
Sent: Friday, August 14, 2009 10:41 AM
To: Mailing list for lwIP users
Subject: RE: [lwip-users] DNS question

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



_______________________________________________
lwip-users mailing list
address@hidden
http://lists.nongnu.org/mailman/listinfo/lwip-users




reply via email to

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