Hi everyone,
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):
le_mdc_ConnectService();
defaultModemProfile = le_mdc_GetProfile(LE_MDC_DEFAULT_PROFILE);
le_mdc_SetAPN(defaultModemProfile, "att.mvno");
le_mdc_SetPDP(defaultModemProfile, LE_MDC_PDP_IPV4);
le_mdc_ConState_t state;
le_mdc_GetSessionState(defaultModemProfile, &state);
le_mdc_StartSession(defaultModemProfile);
The connection seems to work fine using this logic. Then, via libcurl, I’m doing the following:
curl_global_init(CURL_GLOBAL_ALL);
CURL *myHandle;
CURLcode result;
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);
curl_easy_cleanup(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!