Click here to Skip to main content
15,908,111 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: How to Send/Post Message to a CDocument object? Pin
Albert Holguin27-Jun-11 11:41
professionalAlbert Holguin27-Jun-11 11:41 
GeneralRe: How to Send/Post Message to a CDocument object? Pin
Vaclav_27-Jun-11 13:44
Vaclav_27-Jun-11 13:44 
GeneralRe: How to Send/Post Message to a CDocument object? Pin
Albert Holguin27-Jun-11 15:15
professionalAlbert Holguin27-Jun-11 15:15 
Questionstandard way to parse command line from a string Pin
Ribhi Kamal27-Jun-11 8:59
professionalRibhi Kamal27-Jun-11 8:59 
AnswerRe: standard way to parse command line from a string [modified] Pin
CPallini27-Jun-11 9:48
mveCPallini27-Jun-11 9:48 
AnswerRe: standard way to parse command line from a string Pin
David Crow27-Jun-11 10:05
David Crow27-Jun-11 10:05 
AnswerRe: standard way to parse command line from a string Pin
Richard MacCutchan27-Jun-11 22:07
mveRichard MacCutchan27-Jun-11 22:07 
QuestionIO Completion Ports and windows sockets Pin
csrss27-Jun-11 7:19
csrss27-Jun-11 7:19 
Hi! I am completely stuck with it and don't know what to do.
The actual code is pretty huge so i'll skip it and try to explain things. So.
I am trying to write an echo server using completion ports and AcceptEx winsock extension. So far i got a server which can accept only one client and it works. But. The problem is: it can accept one and the only one client. This is how it goes. Basically i am doing almost same things like in tutorials on the net, extending wsaoverlapped, passing my struct as a parameter (keydata) to createiocompletionport where i am specifying current operation (read, write, accept, etc), and on GetQueuedCompletionStatus i am getting my struct by casting it to returned overlapped struct - if you are familiar with this subject you know what i am talking about.
I am creating a server (in case of server app) thread where i am calling AcceptEx which completion then ends up in worker thread and then i am working only in this worker thread, while initial server thread just sleeps waiting for termination. So, when AcceptEx succeeds, i am creating a new my own defined struct, which extends wsaoverlapped and calling AcceptEx again, then processing other operations, like read, write etc. And there is a problem, when new client connects to a server, this new AcceptEx accepts new client connection, but then previous connection gets terminated and this new connection gets terminated too. I have just started learning IOCP and there is a question:
in my project there is one server thread, which first do:
1. creating main listen socket
1a. launching worker thread with GetQueuedCompletionStatus
2. creating this fancy, so called, OverlappedPlus struct which holds some info
3. creating new socket for AcceptEx call
4. binds on port and starts listen
4a. Setting current operation to IOAccept
5. call AcceptEx (with all required params including pointer to wsaoverlapped struct which is first in my OverlappedPlus struct) and goes to sleep forever.

----[ at this point controls jumps to worker thread ]----

1. GetQueuedCompletionStatus and then get OverlappedPlus.
2. Check which operation do we have? We got IOAccept (i have written separate functions for processing these "events"), ok, jump to OnIOAccept.
3. Create new OverlappedPlus struct, new socket for AcceptEx call, update completion port with this new socket and call AcceptEx which then have to wait for new client.
4. Process then any other IO operations.

And all this works fine while there is only one client. When new client connecting to a server app, everything gets terminated. What am i doing wrong?
Thanks
011011010110000101100011011010000110100101101110
0110010101110011

AnswerRe: IO Completion Ports and windows sockets Pin
jschell27-Jun-11 8:14
jschell27-Jun-11 8:14 
GeneralRe: IO Completion Ports and windows sockets Pin
csrss27-Jun-11 8:44
csrss27-Jun-11 8:44 
AnswerRe: IO Completion Ports and windows sockets [modified] Pin
Mark Salsbery27-Jun-11 13:18
Mark Salsbery27-Jun-11 13:18 
GeneralRe: IO Completion Ports and windows sockets Pin
csrss27-Jun-11 14:04
csrss27-Jun-11 14:04 
GeneralRe: IO Completion Ports and windows sockets Pin
Mark Salsbery27-Jun-11 14:13
Mark Salsbery27-Jun-11 14:13 
GeneralRe: IO Completion Ports and windows sockets Pin
csrss27-Jun-11 14:31
csrss27-Jun-11 14:31 
QuestionSOLVED MoveWindow dynamically - how to determine the destination? Pin
Vaclav_27-Jun-11 6:35
Vaclav_27-Jun-11 6:35 
AnswerRe: MoveWindow dynamically - how to determine the destination? Pin
Richard MacCutchan27-Jun-11 7:30
mveRichard MacCutchan27-Jun-11 7:30 
GeneralRe: MoveWindow dynamically - how to determine the destination? Pin
Albert Holguin27-Jun-11 8:19
professionalAlbert Holguin27-Jun-11 8:19 
GeneralRe: MoveWindow dynamically - how to determine the destination? Pin
Richard MacCutchan27-Jun-11 21:52
mveRichard MacCutchan27-Jun-11 21:52 
GeneralRe: MoveWindow dynamically - how to determine the destination? Pin
Albert Holguin28-Jun-11 3:36
professionalAlbert Holguin28-Jun-11 3:36 
AnswerRe: MoveWindow dynamically - how to determine the destination? Pin
Albert Holguin27-Jun-11 7:30
professionalAlbert Holguin27-Jun-11 7:30 
GeneralRe: MoveWindow dynamically - how to determine the destination? Pin
Vaclav_27-Jun-11 13:38
Vaclav_27-Jun-11 13:38 
GeneralRe: MoveWindow dynamically - how to determine the destination? Pin
Albert Holguin27-Jun-11 15:14
professionalAlbert Holguin27-Jun-11 15:14 
Questionlocalizing MFC feature pack (VS 2008) resources. Pin
kle8vi27-Jun-11 1:09
kle8vi27-Jun-11 1:09 
QuestionError while using A_StringFromGUID2 Pin
Pranit Kothari26-Jun-11 23:01
Pranit Kothari26-Jun-11 23:01 
AnswerRe: Error while using A_StringFromGUID2 Pin
Iain Clarke, Warrior Programmer26-Jun-11 23:19
Iain Clarke, Warrior Programmer26-Jun-11 23:19 

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.