Click here to Skip to main content
15,886,052 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Curious Pin
Stephen Hewitt19-Apr-10 13:54
Stephen Hewitt19-Apr-10 13:54 
GeneralRe: Curious Pin
Gwenio19-Apr-10 14:02
Gwenio19-Apr-10 14:02 
Questionwchar_t / C++ Pin
Fareed Rizkalla18-Apr-10 9:19
Fareed Rizkalla18-Apr-10 9:19 
AnswerRe: wchar_t / C++ Pin
Chris Losinger18-Apr-10 9:51
professionalChris Losinger18-Apr-10 9:51 
AnswerRe: wchar_t / C++ Pin
Richard MacCutchan18-Apr-10 11:09
mveRichard MacCutchan18-Apr-10 11:09 
QuestionWinSock 2 / Win32 Pin
Fareed Rizkalla18-Apr-10 9:15
Fareed Rizkalla18-Apr-10 9:15 
AnswerRe: WinSock 2 / Win32 Pin
Richard Andrew x6418-Apr-10 13:33
professionalRichard Andrew x6418-Apr-10 13:33 
AnswerRe: WinSock 2 / Win32 [modified] Pin
Moak18-Apr-10 20:21
Moak18-Apr-10 20:21 
Fareed Rizkalla wrote:
do 
{
	ReceivedBytes = recv(IPv4, TCPrecv, DEFAULT_BUFLEN, 0);
	TotalBytesDownloaded += ReceivedBytes;
	Download->BytesDownloaded += ReceivedBytes;
	DownloadFile << TCPrecv;
}
while (ReceivedBytes && Download->DownloadState == Download->ACTIVE);


First without a protocol you don't know if the complete content data was transferred or the connection was interrupted. Second you do not have any error handling in the loop, recv() can return -1 in error cases. Third your receive buffer TCPrecv is used to insert data with ostream::operator<< but the text data is never null terminated (or otherwise indicated how long it is). Could that be a problem?

Hope this helps,
M

Webchat in Europe Java | [Coffee] Now with 26% more Twitter


modified on Monday, April 19, 2010 4:58 AM

GeneralRe: WinSock 2 / Win32 Pin
Fareed Rizkalla19-Apr-10 3:10
Fareed Rizkalla19-Apr-10 3:10 
GeneralRe: WinSock 2 / Win32 Pin
Moak19-Apr-10 4:09
Moak19-Apr-10 4:09 
GeneralRe: WinSock 2 / Win32 Pin
Spawn@Melmac19-Apr-10 4:27
Spawn@Melmac19-Apr-10 4:27 
GeneralRe: WinSock 2 / Win32 Pin
Fareed Rizkalla4-May-10 21:02
Fareed Rizkalla4-May-10 21:02 
GeneralRe: WinSock 2 / Win32 Pin
Spawn@Melmac5-May-10 0:13
Spawn@Melmac5-May-10 0:13 
Questionprevious next button to change pictures Pin
taouki18-Apr-10 7:04
taouki18-Apr-10 7:04 
AnswerRe: previous next button to change pictures Pin
cconklin18-Apr-10 7:07
cconklin18-Apr-10 7:07 
GeneralRe: previous next button to change pictures Pin
taouki18-Apr-10 7:10
taouki18-Apr-10 7:10 
AnswerRe: previous next button to change pictures Pin
loyal ginger18-Apr-10 7:41
loyal ginger18-Apr-10 7:41 
GeneralRe: previous next button to change pictures Pin
taouki18-Apr-10 7:54
taouki18-Apr-10 7:54 
GeneralRe: previous next button to change pictures Pin
loyal ginger18-Apr-10 9:03
loyal ginger18-Apr-10 9:03 
AnswerRe: previous next button to change pictures Pin
Maximilien18-Apr-10 8:01
Maximilien18-Apr-10 8:01 
QuestionRe: previous next button to change pictures Pin
David Crow19-Apr-10 3:30
David Crow19-Apr-10 3:30 
AnswerRe: previous next button to change pictures Pin
taouki23-Apr-10 23:50
taouki23-Apr-10 23:50 
QuestionClicking a windowless button programatically Pin
Green Fuze18-Apr-10 5:19
Green Fuze18-Apr-10 5:19 
AnswerRe: Clicking a windowless button programatically Pin
Member 321910418-Apr-10 6:40
Member 321910418-Apr-10 6:40 
AnswerRe: Clicking a windowless button programatically Pin
«_Superman_»18-Apr-10 7:52
professional«_Superman_»18-Apr-10 7:52 

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.