CURLcode CheckConnection() { CURLcode retCode = CURLE_GOT_NOTHING; curl_global_init(CURL_GLOBAL_DEFAULT); CURL *curlhandle = curl_easy_init(); if (curlhandle) { curl_easy_setopt(curlhandle,CURLOPT_URL, "FTP://myserver.com"); curl_easy_setopt(curlhandle,CURLOPT_USERPWD, "uname:pass"); curl_easy_setopt(m_curlHandle, CURLOPT_TIMEOUT, 60); curl_easy_setopt(m_curlHandle, CURLOPT_FTP_RESPONSE_TIMEOUT, 30); curl_easy_setopt(curlhandle, CURLOPT_PROXY, "myproxy.com"); curl_easy_setopt(curlhandle,CURLOPT_PROXYUSERPWD, "proxyuname:proxypasswd"); curl_easy_setopt(curlhandle, CURLOPT_WRITEFUNCTION,&write_data); char headerfilename[FILENAME_MAX] = "head.out"; FILE *headerfile; fopen_s(&headerfile, headerfilename,"w"); if (headerfile == NULL) { curl_easy_cleanup(curlhandle); return retCode; } curl_easy_setopt(curlhandle, CURLOPT_WRITEHEADER, headerfile); retCode = curl_easy_perform(curlhandle); curl_easy_cleanup(curlhandle); } curl_global_cleanup(); return retCode; }