I’m having a strange issue with the use of libcurl. I’m attempting to connect to mobile data, then use libcurl to get the contents of a website. However, I always receive the error:
curl_easy_perform() failed: Couldn't resolve host name
I’m using the Modem Data Control service to connect to data. My code is as follows (somewhat truncated, error handling and such excluded):
defaultModemProfile = le_mdc_GetProfile(LE_MDC_DEFAULT_PROFILE);
The connection seems to work fine using this logic. Then, via libcurl, I’m doing the following:
myHandle = curl_easy_init();
char *destUrl = "http://example.com";
curl_easy_setopt(myHandle, CURLOPT_URL, destUrl);
curl_easy_setopt(myHandle, CURLOPT_HTTPGET, 1);
curl_easy_setopt(myHandle, CURLOPT_FOLLOWLOCATION, 1L);
result = curl_easy_perform(myHandle);
However, it always returns the
Couldn't resolve host name error.
Interestingly enough, if I comment out the above code (so my application isn’t establishing the connection), and instead use the
cm data connect command through SSH, then run my application, libcurl returns the page with no issues.
Based on that, I’m thinking maybe this is some sort of DNS issue, although I can’t say for sure. Is there some means by which I’m supposed to configuring DNS through the Modem Data Control service?
Thanks much in advance!