Click here to Skip to main content
15,892,674 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: topic for a research proposal! Pin
Richard MacCutchan1-Dec-09 22:49
mveRichard MacCutchan1-Dec-09 22:49 
AnswerRe: topic for a research proposal! Pin
Rozis28-Nov-09 4:18
Rozis28-Nov-09 4:18 
GeneralRe: topic for a research proposal! Pin
cool_joy21-Dec-09 21:43
cool_joy21-Dec-09 21:43 
AnswerRe: topic for a research proposal! Pin
Michael Schubert29-Nov-09 7:11
Michael Schubert29-Nov-09 7:11 
GeneralRe: topic for a research proposal! Pin
cool_joy21-Dec-09 21:45
cool_joy21-Dec-09 21:45 
Questionkeeping track of users count Pin
nuttynibbles28-Nov-09 1:55
nuttynibbles28-Nov-09 1:55 
AnswerRe: keeping track of users count Pin
Richard MacCutchan28-Nov-09 2:17
mveRichard MacCutchan28-Nov-09 2:17 
GeneralRe: keeping track of users count Pin
nuttynibbles28-Nov-09 2:55
nuttynibbles28-Nov-09 2:55 
Questionerror while using fild name as timestamp Pin
thangvel27-Nov-09 22:59
thangvel27-Nov-09 22:59 
QuestionRe: error while using fild name as timestamp Pin
Richard MacCutchan28-Nov-09 1:41
mveRichard MacCutchan28-Nov-09 1:41 
QuestionRe: error while using fild name as timestamp Pin
David Crow29-Nov-09 16:28
David Crow29-Nov-09 16:28 
QuestionNeed a Similar API AudioVideoPlayback in unmanage code Pin
Shivanand Gupta27-Nov-09 19:00
Shivanand Gupta27-Nov-09 19:00 
AnswerRe: Need a Similar API AudioVideoPlayback in unmanage code Pin
Richard MacCutchan27-Nov-09 21:47
mveRichard MacCutchan27-Nov-09 21:47 
QuestionPlay Two video file in different left right speaker Pin
Shivanand Gupta27-Nov-09 18:54
Shivanand Gupta27-Nov-09 18:54 
AnswerRe: Play Two video file in different left right speaker Pin
Richard MacCutchan27-Nov-09 21:45
mveRichard MacCutchan27-Nov-09 21:45 
AnswerRe: Play Two video file in different left right speaker Pin
Rozis28-Nov-09 4:22
Rozis28-Nov-09 4:22 
QuestionConverting different data types from a class template. Pin
Member 382253227-Nov-09 15:10
Member 382253227-Nov-09 15:10 
AnswerRe: Converting different data types from a class template. Pin
«_Superman_»27-Nov-09 17:19
professional«_Superman_»27-Nov-09 17:19 
QuestionOpen-With menu items for given file extension Pin
michalJ27-Nov-09 13:25
michalJ27-Nov-09 13:25 
AnswerRe: Open-With menu items for given file extension Pin
Rozis28-Nov-09 4:25
Rozis28-Nov-09 4:25 
QuestionUploading a file using CHttpFile Pin
msn9227-Nov-09 12:17
msn9227-Nov-09 12:17 
Hi
I'm uploading a file using CInternetSession, CHttpConnection and CHttpFile.
The program is working properly. However, I have some questions:


1. Does the program send data each time CHttpFile::Write() called? Or are all data sent when CHttpFile::EndRequest() called?
2. How big should the buffer size be(while reading from local file and writing to CHttpFile)?[Please see the source code below]
3. Does using Keep-alive connection(INTERNET_FLAG_KEEP_CONNECTION) help in any way?[Please see the source code below]

CInternetSession ises = NULL;
CHttpFile* httpf = NULL;
CHttpConnection *connection = NULL;

file=new CFile(L"file2upload.txt",CFile::modeRead);

connection = ises.GetHttpConnection(L"myserver.com");

http = connection->OpenRequest(CHttpConnection::HTTP_VERB_POST, L"upload.php",0,1,0,0,INTERNET_FLAG_KEEP_CONNECTION);

CString hdrs /* = My appropriate headers to send */;
httpf->AddRequestHeaders(hdrs);

PreFileData /* = prefile data */;
PostFileData /* = postfile data */;

httpf->SendRequestEx(DWORD(PreFileData.GetLength()+file->GetLength()+PostFileData.GetLength()), HSR_SYNC | HSR_INITIATE);

httpf->Write((LPSTR)(LPCSTR)PreFileData, PreFileData.GetLength());

UINT len=1024;
char buf[1024]; /*BUFFER SIZE = 1024 HOW BIG ACTUALLY SHOULD IT BE?*/
while(len>0){
	len=f->Read(&buf,1024);
	if(len>0)httpf->Write(&buf,len);
}

httpf->Write((LPSTR)(LPCSTR)PostFileData, PostFileData.GetLength());

httpf->EndRequest(HSR_SYNC);

file->Close();
httpf->Close();
connection->Close();


Thanks in advance
QuestionThread handle from thread ID [solved] Pin
PJ Arends27-Nov-09 10:40
professionalPJ Arends27-Nov-09 10:40 
AnswerRe: Thread handle from thread ID Pin
Garth J Lancaster27-Nov-09 11:28
professionalGarth J Lancaster27-Nov-09 11:28 
GeneralRe: Thread handle from thread ID Pin
PJ Arends27-Nov-09 17:01
professionalPJ Arends27-Nov-09 17:01 
Questionplease help : how to draw BSpline by using mouse ??? Pin
a04.lqd27-Nov-09 6:59
a04.lqd27-Nov-09 6:59 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.