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

C / C++ / MFC

 
AnswerRe: MFC SDI and Dialog Boxes (it can be a little offtopic) Pin
Joan M6-Feb-07 20:41
professionalJoan M6-Feb-07 20:41 
AnswerRe: MFC SDI and Dialog Boxes Pin
#realJSOP7-Feb-07 2:02
professional#realJSOP7-Feb-07 2:02 
QuestionOnReceive stop being called [modified] Pin
jpyp6-Feb-07 7:30
jpyp6-Feb-07 7:30 
QuestionRe: OnReceive stop being called Pin
Mark Salsbery6-Feb-07 14:04
Mark Salsbery6-Feb-07 14:04 
QuestionRe: OnReceive stop being called Pin
Mark Salsbery6-Feb-07 14:12
Mark Salsbery6-Feb-07 14:12 
AnswerRe: OnReceive stop being called Pin
jpyp7-Feb-07 11:41
jpyp7-Feb-07 11:41 
GeneralRe: OnReceive stop being called Pin
Mark Salsbery7-Feb-07 12:05
Mark Salsbery7-Feb-07 12:05 
GeneralRe: OnReceive stop being called Pin
Mike O'Neill7-Feb-07 15:49
Mike O'Neill7-Feb-07 15:49 
The basic advice is that you should make exactly one single call to Receive (which calls the underlying winsock recv() function) from inside your OnReceive function (which the MFC framework calls in response to an FD_READ notification).

This advice can't be found in the MFC documentation, either for CSocket or for CAsnycSocket.

It's found, however, in the documentation for the underlying Winsock functions. For example, see the documentation for WSAAsyncSelect() (which is the Winsock function that causes Windows-style messages to be posted to your application from the network stack) at http://msdn2.microsoft.com/en-us/library/ms741540.aspx[^], which includes this quote:

MSDN at WSAASyncSelect wrote:
With these semantics, an application need not read all available data in response to an FD_READ message — a single recv in response to each FD_READ message is appropriate. If an application issues multiple recv calls in response to a single FD_READ, it can receive multiple FD_READ messages. Such an application can require disabling FD_READ messages before starting the recv calls by calling WSAAsyncSelect with the FD_READ event not set.


The point of this is to suggest that you get closer to the Winsock API when you start programming for high-rate transfers. There a a few dozen of these "gotcha's" that you don't learn/know about when using the MFC classes, particularly the CSocket class. Personally, I would avoid CSocket. CAsyncSocket is fine, since it's reasonably close to the Winsock API, but you still need to understand the underlying API if you expect your program to work correctly.

Mike
GeneralRe: OnReceive stop being called Pin
jpyp8-Feb-07 9:35
jpyp8-Feb-07 9:35 
QuestionSingleton inheritance Pin
Waldermort6-Feb-07 7:20
Waldermort6-Feb-07 7:20 
AnswerRe: Singleton inheritance Pin
Cedric Moonen6-Feb-07 7:48
Cedric Moonen6-Feb-07 7:48 
GeneralRe: Singleton inheritance Pin
Waldermort6-Feb-07 8:05
Waldermort6-Feb-07 8:05 
GeneralRe: Singleton inheritance Pin
Cedric Moonen6-Feb-07 8:16
Cedric Moonen6-Feb-07 8:16 
GeneralRe: Singleton inheritance Pin
Waldermort6-Feb-07 8:30
Waldermort6-Feb-07 8:30 
GeneralRe: Singleton inheritance Pin
Cedric Moonen6-Feb-07 8:33
Cedric Moonen6-Feb-07 8:33 
GeneralRe: Singleton inheritance Pin
Waldermort6-Feb-07 8:53
Waldermort6-Feb-07 8:53 
QuestionCalling a macro in Excel [modified] Pin
deville756-Feb-07 7:13
deville756-Feb-07 7:13 
QuestionSQL Problem Pin
_anil_6-Feb-07 2:40
_anil_6-Feb-07 2:40 
AnswerRe: SQL Problem Pin
Chris Losinger6-Feb-07 3:04
professionalChris Losinger6-Feb-07 3:04 
GeneralRe: SQL Problem Pin
_anil_6-Feb-07 3:39
_anil_6-Feb-07 3:39 
QuestionRe: SQL Problem Pin
David Crow6-Feb-07 3:30
David Crow6-Feb-07 3:30 
AnswerRe: SQL Problem Pin
_anil_6-Feb-07 3:37
_anil_6-Feb-07 3:37 
QuestionRe: SQL Problem Pin
David Crow6-Feb-07 3:57
David Crow6-Feb-07 3:57 
AnswerRe: SQL Problem Pin
_anil_6-Feb-07 4:37
_anil_6-Feb-07 4:37 
Questionfile manipulation in c Pin
deeps_cute6-Feb-07 2:23
deeps_cute6-Feb-07 2: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.