Error connecting to server by proxy server in c++ socket programming -


the code connection :

    cout << "connecting1\n";     wsadata wsadata;     int iresult = wsastartup (makeword(2,2), &wsadata );     if (iresult !=no_error )         printf("\nmyerror @ wsastartup()\n");     int sock = socket(af_inet, sock_stream, 0);     if (sock == -1) {         perror("error opening socket"); return -1;     }     struct sockaddr_in sin;     sin.sin_port = htons(port);     sin.sin_addr.s_addr = inet_addr(host.c_str());     sin.sin_family = af_inet;      if (connect(sock, (struct sockaddr *)&sin, sizeof(sin)) == -1) {         perror("error connecting host"); return -1;     }     const int query_len = query.length() + 1; // trailing '\0'     if (send(sock, query.c_str(), query_len, 0) != query_len) {         perror("error sending query"); return -1;     }      const int buf_size = 1024 * 1024;     while (true) {         std::vector<char> buf(buf_size, '\0');         const int recv_len = recv(sock, &buf[0], buf_size - 1, 0);          if (recv_len == -1) {             perror("error receiving response"); return -1;         } else if (recv_len == 0) {             std::cout << std::endl; break;         } else {             std::cout << &buf[0];                        fprintf(fp, "%s", &buf[0]);         }     } 

in wifi without proxy works fine, when use proxy server, net can accessed in chrome, above code prints

connecting1  error connecting host 

what problem ?


Comments

Popular posts from this blog

ios - iPhone/iPad different view orientations in different views , and apple approval process -

php - HTTP_REFERER woes: How can I allow access to a specific page, only when a visitor has visited another specific page beforehand? -

java Extracting Zip file -