Click here to Skip to main content
15,896,278 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Different CSplitterWnd behaviour needed Pin
Vladimir Svrkota7-Jun-06 16:06
professionalVladimir Svrkota7-Jun-06 16:06 
QuestionOverlapped sockets and completion routines. Pin
luke7276-Jun-06 13:43
luke7276-Jun-06 13:43 
I'm trying to send and receive data using overlapped sockets and completion routines. Everything works fine, except that quite often the final WSARecv doesn't complete until after some kind of (VERY LONG) timeout. This is basically what my completion routine functions look like:

void CALLBACK OnReceiveComplete(...)
{
	if(cbTransferred == 0)
	{
		// Doesn't get here until after a long timeout.
		printf("Done.\r\n");
	}
	else
	{
		printf("Received %d bytes.\r\n", cbTransferred);
		WSARecv(..., &OnReceiveComplete);
	}
}

void CALLBACK OnSendComplete(...)
{
	printf("Sent %d bytes.\r\n", cbTransferred);
	WSARecv(..., &OnReceiveComplete);
}


Obviously there is error checking and other things, but that is the gist of it.

Interestingly it doesn't happen on all attempts. I'm doing a simple HTTP GET, and it ALWAYS "hangs" on "www.google.com", but it NEVER does on "www.cnn.com". Does this have something to do with how the servers are setup, or is there something I can do about this? Right now I just forcefully close the socket if I don't get any response for a certain amount of time. I've seen lots of examples for IOCP and overlapped events, but NONE for overlapped completion routines. I haven't been able to figure out this problem for the longest time, so this is my last-ditch attempt to get an answer.

On a side note, if I use the WinInet functions asynchronously the problem goes away (but there are other issues with using WinInet so I want to avoid it). So obviously there must be some way to know when there is no more data to read. I just can't figure it out.
QuestionDrawing a bitmap Pin
Pugman8126-Jun-06 12:12
Pugman8126-Jun-06 12:12 
AnswerRe: Drawing a bitmap Pin
Chris Losinger6-Jun-06 15:46
professionalChris Losinger6-Jun-06 15:46 
GeneralRe: Drawing a bitmap Pin
Pugman8126-Jun-06 23:07
Pugman8126-Jun-06 23:07 
GeneralRe: Drawing a bitmap [modified] Pin
Chris Losinger7-Jun-06 1:13
professionalChris Losinger7-Jun-06 1:13 
Questionwhich function gets color setting of PC? Pin
includeh106-Jun-06 10:27
includeh106-Jun-06 10:27 
AnswerRe: which function gets color setting of PC? Pin
Ryan Binns6-Jun-06 18:25
Ryan Binns6-Jun-06 18:25 
QuestionSocket Connection Pin
SPowers6-Jun-06 8:43
SPowers6-Jun-06 8:43 
QuestionCreateDIBSection Pin
includeh106-Jun-06 8:36
includeh106-Jun-06 8:36 
AnswerRe: CreateDIBSection Pin
valikac6-Jun-06 9:20
valikac6-Jun-06 9:20 
GeneralRe: CreateDIBSection Pin
includeh106-Jun-06 9:30
includeh106-Jun-06 9:30 
AnswerRe: CreateDIBSection Pin
Chris Losinger6-Jun-06 9:53
professionalChris Losinger6-Jun-06 9:53 
GeneralRe: CreateDIBSection Pin
includeh106-Jun-06 10:15
includeh106-Jun-06 10:15 
GeneralRe: CreateDIBSection Pin
Chris Losinger6-Jun-06 11:25
professionalChris Losinger6-Jun-06 11:25 
GeneralRe: CreateDIBSection Pin
includeh106-Jun-06 11:55
includeh106-Jun-06 11:55 
GeneralRe: CreateDIBSection Pin
Chris Losinger6-Jun-06 15:30
professionalChris Losinger6-Jun-06 15:30 
Questionquestion about HBITMAP Pin
includeh106-Jun-06 8:24
includeh106-Jun-06 8:24 
AnswerRe: question about HBITMAP Pin
Chris Losinger6-Jun-06 8:30
professionalChris Losinger6-Jun-06 8:30 
GeneralRe: question about HBITMAP Pin
includeh106-Jun-06 8:44
includeh106-Jun-06 8:44 
GeneralRe: question about HBITMAP Pin
Chris Losinger6-Jun-06 9:46
professionalChris Losinger6-Jun-06 9:46 
GeneralRe: question about HBITMAP Pin
includeh106-Jun-06 10:22
includeh106-Jun-06 10:22 
GeneralRe: question about HBITMAP Pin
Chris Losinger6-Jun-06 11:28
professionalChris Losinger6-Jun-06 11:28 
GeneralRe: question about HBITMAP Pin
includeh106-Jun-06 11:56
includeh106-Jun-06 11:56 
GeneralRe: question about HBITMAP Pin
Chris Losinger6-Jun-06 15:39
professionalChris Losinger6-Jun-06 15:39 

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.