![]() |
network programming -- bad request
I'm trying to make a web crawler. But when I do a loop to fill the buffer, it fills then keeps doing recv() calls and those calls get BAD REQUESTS with only part of the downloaded file.
char tBuffer[kBufferSize]; int bytesRead = 1; //bytesRead = recv(s,tempBuffer,bufferSize,0); //recvBuffer=tempBuffer; while (bytesRead>0){ bytesRead=recv(s,tBuffer,kBufferSize,0); if(bytesRead==0){ cout << "##################################" << endl << "Done Reading From Site" << endl; break; } acReadBuffer=acReadBuffer + tBuffer; } cout << acReadBuffer << endl; |
Post the request your sending to the server.
|
request
command = "GET / HTTP/1.1 \r\nHost: "+host_name+"\r\n\r\nConnection: Close\r\n";
cout << command; err = send(s,command.c_str(),strlen(command.c_str()),0); |
| All times are GMT -5. The time now is 02:50 PM. |