LinuxQuestions.org
Support LQ: Use code LQ3 and save $3 on Domain Registration
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices

Reply
 
Search this Thread
Old 09-20-2004, 08:13 PM   #1
mehesque
Member
 
Registered: Oct 2003
Location: TX
Distribution: RH 8.0
Posts: 97

Rep: Reputation: 15
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;
 
Old 09-20-2004, 09:01 PM   #2
Stack
Member
 
Registered: Oct 2003
Distribution: FreeBSD
Posts: 325

Rep: Reputation: 30
Post the request your sending to the server.
 
Old 09-21-2004, 01:28 PM   #3
mehesque
Member
 
Registered: Oct 2003
Location: TX
Distribution: RH 8.0
Posts: 97

Original Poster
Rep: Reputation: 15
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);
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
opera: client-error-bad-request landroni Linux - Software 0 11-22-2005 10:22 AM
svc bad request dropping packet naveenrajn Linux - Networking 0 07-04-2005 04:22 AM
client-error-bad-request when trying to print with lp blas Linux - General 4 02-09-2005 10:30 AM
Bad Request when web page loading wmartino Linux - Networking 2 09-14-2003 09:25 AM
Dispatch_input: bad request line Advocate Linux - Security 3 05-04-2001 02:31 AM


All times are GMT -5. The time now is 05:19 PM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration