Click here to Skip to main content
13,864,549 members

C / C++ / MFC

 
QuestionPlay Two video file in different left right speaker Pin
Shivanand Gupta27-Nov-09 19:54
memberShivanand Gupta27-Nov-09 19:54 
AnswerRe: Play Two video file in different left right speaker Pin
Richard MacCutchan27-Nov-09 22:45
protectorRichard MacCutchan27-Nov-09 22:45 
AnswerRe: Play Two video file in different left right speaker Pin
Rozis28-Nov-09 5:22
memberRozis28-Nov-09 5:22 
QuestionConverting different data types from a class template. Pin
Member 382253227-Nov-09 16:10
memberMember 382253227-Nov-09 16:10 
AnswerRe: Converting different data types from a class template. Pin
«_Superman_»27-Nov-09 18:19
professional«_Superman_»27-Nov-09 18:19 
QuestionOpen-With menu items for given file extension Pin
michalJ27-Nov-09 14:25
membermichalJ27-Nov-09 14:25 
AnswerRe: Open-With menu items for given file extension Pin
Rozis28-Nov-09 5:25
memberRozis28-Nov-09 5:25 
QuestionUploading a file using CHttpFile Pin
msn9227-Nov-09 13:17
membermsn9227-Nov-09 13: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 11:40
professionalPJ Arends27-Nov-09 11:40 
AnswerRe: Thread handle from thread ID Pin
Garth J Lancaster27-Nov-09 12:28
professionalGarth J Lancaster27-Nov-09 12:28 
GeneralRe: Thread handle from thread ID Pin
PJ Arends27-Nov-09 18:01
professionalPJ Arends27-Nov-09 18:01 
Questionplease help : how to draw BSpline by using mouse ??? Pin
a04.lqd27-Nov-09 7:59
membera04.lqd27-Nov-09 7:59 
AnswerRe: please help : how to draw BSpline by using mouse ??? Pin
Richard MacCutchan27-Nov-09 8:14
protectorRichard MacCutchan27-Nov-09 8:14 
GeneralRe: please help : how to draw BSpline by using mouse ??? Pin
a04.lqd27-Nov-09 8:19
membera04.lqd27-Nov-09 8:19 
GeneralRe: please help : how to draw BSpline by using mouse ??? Pin
Richard MacCutchan27-Nov-09 8:27
protectorRichard MacCutchan27-Nov-09 8:27 
GeneralRe: please help : how to draw BSpline by using mouse ??? Pin
Cedric Moonen27-Nov-09 8:28
memberCedric Moonen27-Nov-09 8:28 
GeneralRe: please help : how to draw BSpline by using mouse ??? Pin
CPallini27-Nov-09 8:26
mveCPallini27-Nov-09 8:26 
GeneralRe: please help : how to draw BSpline by using mouse ??? Pin
Richard MacCutchan27-Nov-09 8:28
protectorRichard MacCutchan27-Nov-09 8:28 
AnswerRe: please help : how to draw BSpline by using mouse ??? Pin
«_Superman_»27-Nov-09 10:15
professional«_Superman_»27-Nov-09 10:15 
QuestionQuestion about double #INF and #NAN Pin
Jeff Archer27-Nov-09 6:02
memberJeff Archer27-Nov-09 6:02 
QuestionRe: Question about double #INF and #NAN Pin
CPallini27-Nov-09 6:54
mveCPallini27-Nov-09 6:54 
AnswerRe: Question about double #INF and #NAN Pin
Jeff Archer27-Nov-09 8:08
memberJeff Archer27-Nov-09 8:08 
GeneralRe: Question about double #INF and #NAN Pin
Richard MacCutchan27-Nov-09 8:17
protectorRichard MacCutchan27-Nov-09 8:17 
GeneralRe: Question about double #INF and #NAN Pin
Jeff Archer27-Nov-09 8:51
memberJeff Archer27-Nov-09 8:51 
GeneralRe: Question about double #INF and #NAN Pin
CPallini27-Nov-09 8:23
mveCPallini27-Nov-09 8:23 

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.


Advertise | Privacy | Cookies | Terms of Service
Web03 | 2.8.190214.1 | Last Updated 18 Feb 2019
Copyright © CodeProject, 1999-2019
All Rights Reserved.
Layout: fixed | fluid