Original Post
I'm getting a ERROR_WINHTTP_CANNOT_CONNECT when I call InternetConnect. There isn't much info on it other than the obvious (it can't connect). The app works fine for a while (hours) and then it starts returning this error. When I restart the app, the app works fine again. This leads me to think it's the app itself and not the server. The app connects to FTP server and sends a file. main() { hinternet = NULL; hinternet = InternetOpen("MyApp",INTERNET_OPEN_TYPE_DIRECT,NULL,0,0); } ..another thread { while(run == true) { if(UpdateFile() == true) { hftp = InternetConnect(hinternet, "some_server", 123, INTERNET_DEFAULT_SOCKS_PORT, "user", "user"...); if(hftp == NULL) { InternetCloseHandle(hinternet); hinternet = InternetOpen("MyApp",INTERNET_OPEN_TYPE_DIRECT,NULL,0,0); } else { FtpWriteFile(..); InternetCloseHandle(hftp); } } } } Am I missing something?? I close the handle to InternetConnect after a successful ftp of file. On errors, I close the handle to InternetOpen and open a new handle. Thanks in advance.