wiced_hostname_lookup problems

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
SuMa_296631
Level 5
Level 5
50 replies posted 25 replies posted 10 replies posted

I am trying to use the 'wiced_hostname_lookup' function to convert a text URL into an IP address, but I only get "WICED_ERROR" as the response.

I can get back a URL that is the IP address in dotted text string format.

Immediately prior to making my call, I can use the NTP functions that also contain a call to this function and that seems to work, and immediately afterwards I can make a UDP connection to a remote server and that all works OK. Therefore I believe that the WiFI network is all set up and working correctly.

The documentation appears to be sadly lacking for this (and many other) functions so I have no idea if there are restriction's or prior functions that must be called to get this to work.

Any suggestions would be appreciated.

Susan

(SDK 2.4.1, STM32F1xx in an SN8200x, Threadx and Netx Duo)

0 Likes
1 Solution
SuMa_296631
Level 5
Level 5
50 replies posted 25 replies posted 10 replies posted

The problem is that I had called the 'wiced_hostname_lookup' function with a timeout value of WICED_NEVER_TIMEOUT. This translates to "-1".

The 'dns_client_hostname_lookup' function (that does all of the work) uses the initial timeout value in a "while" loop for multiple DNS lookup attempts, each time counting down the remaining timeout value until it goes negative.

Therefore, by passing WICED_NEVER_TIMEOUT, the "while" loop was never executing which made the function report the error.

It really is a pity that the documentation is not written with proper descriptions of the functions actions, the valid (or invalid) ranges for the parameters and the meanings of the return values.

Susan

View solution in original post

0 Likes
1 Reply
SuMa_296631
Level 5
Level 5
50 replies posted 25 replies posted 10 replies posted

The problem is that I had called the 'wiced_hostname_lookup' function with a timeout value of WICED_NEVER_TIMEOUT. This translates to "-1".

The 'dns_client_hostname_lookup' function (that does all of the work) uses the initial timeout value in a "while" loop for multiple DNS lookup attempts, each time counting down the remaining timeout value until it goes negative.

Therefore, by passing WICED_NEVER_TIMEOUT, the "while" loop was never executing which made the function report the error.

It really is a pity that the documentation is not written with proper descriptions of the functions actions, the valid (or invalid) ranges for the parameters and the meanings of the return values.

Susan

0 Likes