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

C / C++ / MFC

 
AnswerRe: searching files Pin
Hamid_RT7-Apr-06 19:45
Hamid_RT7-Apr-06 19:45 
AnswerRe: searching files Pin
Aqueel7-Apr-06 19:59
Aqueel7-Apr-06 19:59 
QuestionBalanced Binary Trees Pin
TranscendentalSoftware7-Apr-06 17:39
TranscendentalSoftware7-Apr-06 17:39 
AnswerRe: Balanced Binary Trees Pin
El Corazon7-Apr-06 20:09
El Corazon7-Apr-06 20:09 
GeneralRe: Balanced Binary Trees Pin
TranscendentalSoftware7-Apr-06 20:21
TranscendentalSoftware7-Apr-06 20:21 
GeneralRe: Balanced Binary Trees Pin
Blake Miller10-Apr-06 5:15
Blake Miller10-Apr-06 5:15 
QuestionCAsyncSocket Question Pin
JBAK_CP7-Apr-06 14:30
JBAK_CP7-Apr-06 14:30 
AnswerRe: CAsyncSocket Question Pin
Mike O'Neill8-Apr-06 8:00
Mike O'Neill8-Apr-06 8:00 
The mistake you're making is that you are trying to use asynchronous sockets synchronously.

In synchronous sockets, you tell the socket what to do, step by step.

In asynchronous sockets, the socket tells you that it's ready to do something, and then you tell it to try.

If an asynchronous socket can't do what you tell it to, then it returns SOCKET_ERROR and WSAGetLastError returns WSAEWOULDBLOCK. This signifies that the requested operation cannot be performed without blocking (which you don't want), and that the socket will tell you later, when it's ready, to try again. Then, later (and asynchronously), the socket will send an FD_CONNECT message to your message loop (or something similar, like FD_READ, depending on circumstances), which eventually filters down to your override of the virtual OnConnect function.

So, WSAEWOULDBLOCK is very common and must be programmed for. In your case, you start the whole process by calling Connect. If it succeeds, then great, do the next thing. But it probably will fail with WSAEWOULDBLOCK. In this case, at some later time in the future, your OnConnect function will be called, signifying that the socket is ready for you to try again. Inside OnConnect, try calling Connect again, but again be ready for the (much lowered) possibility that WSAEWOULDBLOCK might be returned again.

You need to do this for each significant event that you are interested in, like OnReceive, OnSend, OnClose etc.

Mike
QuestionHow to display series of numbers ? Pin
Surivevoli7-Apr-06 13:04
Surivevoli7-Apr-06 13:04 
AnswerRe: How to display series of numbers ? Pin
Ravi Bhavnani7-Apr-06 15:36
professionalRavi Bhavnani7-Apr-06 15:36 
GeneralRe: How to display series of numbers ? Pin
Surivevoli8-Apr-06 0:29
Surivevoli8-Apr-06 0:29 
GeneralRe: How to display series of numbers ? Pin
ThatsAlok8-Apr-06 1:25
ThatsAlok8-Apr-06 1:25 
GeneralRe: How to display series of numbers ? Pin
Ravi Bhavnani8-Apr-06 4:03
professionalRavi Bhavnani8-Apr-06 4:03 
AnswerRe: How to display series of numbers ? Pin
Hamid_RT7-Apr-06 18:42
Hamid_RT7-Apr-06 18:42 
GeneralRe: How to display series of numbers ? Pin
Surivevoli8-Apr-06 0:04
Surivevoli8-Apr-06 0:04 
GeneralRe: How to display series of numbers ? Pin
Hamid_RT8-Apr-06 1:13
Hamid_RT8-Apr-06 1:13 
GeneralRe: How to display series of numbers ? Pin
Hamid_RT8-Apr-06 1:35
Hamid_RT8-Apr-06 1:35 
GeneralRe: How to display series of numbers ? Pin
Surivevoli9-Apr-06 12:47
Surivevoli9-Apr-06 12:47 
GeneralRe: How to display series of numbers ? Pin
Hamid_RT9-Apr-06 18:45
Hamid_RT9-Apr-06 18:45 
AnswerRe: How to display series of numbers ? Pin
ThatsAlok7-Apr-06 23:42
ThatsAlok7-Apr-06 23:42 
GeneralRe: How to display series of numbers ? Pin
Surivevoli8-Apr-06 0:13
Surivevoli8-Apr-06 0:13 
QuestionFlicker draw nightmare Pin
Axonn Echysttas7-Apr-06 11:24
Axonn Echysttas7-Apr-06 11:24 
AnswerRe: Flicker draw nightmare Pin
Richard Andrew x647-Apr-06 13:33
professionalRichard Andrew x647-Apr-06 13:33 
AnswerRe: Flicker draw nightmare Pin
Ravi Bhavnani7-Apr-06 15:41
professionalRavi Bhavnani7-Apr-06 15:41 
QuestionWindows Form Application Problems Pin
Bob X7-Apr-06 10:15
Bob X7-Apr-06 10:15 

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.