title: Get data from the web server and sent them to the client c++
body: <p>I am trying to get some data from the webserver as a proxy,and then sent the data to the client.<br>
  Webserver -> Me -> Client  </p>
  
  <p>This is my main code:  </p>
  
  <pre><code>int main()
  {
      Initialize();
      ServerSocket s;
      s.Bind();
      s.Listen();
      while(true)
      {
          TCPSocket* sock = s.Accept();
  
          ClientSocket client;
          string addr = handle.getAddress();
          short prt = handle.getPort();
  
          client.Connect(addr, prt);
          char data[5000];
          client.Send("GET /index.html HTTP/1.0\r\n\r\n", 28) ;
          while(true)
          {
              int numbytes=client.Recv(data, 5000);
              if(numbytes == 0)
              {
                  break;
              }
              cout &lt;&lt;"Received from web server: " &lt;&lt; numbytes &lt;&lt; endl;
              int numbytes2 = sock-&gt;Send(data, numbytes);
              cout &lt;&lt; "Sent to client: " &lt;&lt; numbytes2 &lt;&lt; endl;
          }
          client.Close();
      }
      s.Close();
      return 0;
  }
  </code></pre>
  
  <p>But when I browse the net,lets say google.com, I get "302 Moved The document has moved here." In every site I get different behavior,but the site won't load up. Am i doing something wrong when I send and receive bytes ? Thanks in advanced.</p>