Click here to Skip to main content
15,116,253 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
QuestionIOCP, Completion Key and Overlapped Pin
csrss1-Jul-11 8:39
Membercsrss1-Jul-11 8:39 
AnswerRe: IOCP, Completion Key and Overlapped Pin
Mark Salsbery1-Jul-11 10:33
MemberMark Salsbery1-Jul-11 10:33 
GeneralRe: IOCP, Completion Key and Overlapped Pin
csrss1-Jul-11 11:48
Membercsrss1-Jul-11 11:48 
GeneralRe: IOCP, Completion Key and Overlapped Pin
cmk1-Jul-11 12:37
Membercmk1-Jul-11 12:37 
GeneralRe: IOCP, Completion Key and Overlapped Pin
Mark Salsbery1-Jul-11 14:08
MemberMark Salsbery1-Jul-11 14:08 
GeneralRe: IOCP, Completion Key and Overlapped Pin
csrss1-Jul-11 20:51
Membercsrss1-Jul-11 20:51 
GeneralRe: IOCP, Completion Key and Overlapped Pin
Mark Salsbery2-Jul-11 7:03
MemberMark Salsbery2-Jul-11 7:03 
AnswerRe: IOCP, Completion Key and Overlapped Pin
cmk1-Jul-11 11:46
Membercmk1-Jul-11 11:46 
One framework I created that used ICOP had the following classes:

IoObj - Base class for I/O
  IoHnd - IFS handle based
    File - OS file access
    NetSocket - Network socket
      NetIpClnt/NetIpSvc, NetTCP*, NetUdp*, NetIrda*, NetBth*, ...
        NetFPT*, NetNNTP*, ...

WSAOVERLAPPED
  IoOL - Base overlapped; adds flags, timestamps, type, control, buffer
    NetIoOLAddr - specialied for sendto/recfrom, contains remote address
    NetIoOLAccept - specialized for handling AcceptEx

IoCP - I/O completion port


The IoCP had the main posting functions and GetQueuedCompletionStatus loop.
To post a msg on an IoCP you'd pass an IoObj* and IoOL*.
The IoObj* would be the key, the IoOL* the overlapped (per call).
The IoCP GetQueuedCompletionStatus loop would call (something like) IoObj->Msg(IoOL*).

With the above you can use one or more IoCP instances to handle any combination of files, sockets, or other IoObj based objects (e.g. jobs/tasks).

I found both having key and OL convenient. Without an explicit key param you'd have to add it as state to your extended OL ... which you may want anyways.
...cmk

The idea that I can be presented with a problem, set out to logically solve it with the tools at hand, and wind up with a program that could not be legally used because someone else followed the same logical steps some years ago and filed for a patent on it is horrifying.
- John Carmack

GeneralRe: IOCP, Completion Key and Overlapped Pin
csrss1-Jul-11 12:13
Membercsrss1-Jul-11 12:13 
QuestionEncryption/Decyption of String. Pin
Le@rner1-Jul-11 3:57
MemberLe@rner1-Jul-11 3:57 
AnswerRe: Encryption/Decyption of String. Pin
Code-o-mat1-Jul-11 4:34
MemberCode-o-mat1-Jul-11 4:34 
AnswerRe: Encryption/Decyption of String. Pin
cmk1-Jul-11 11:56
Membercmk1-Jul-11 11:56 
QuestionMaking an "SDI" MFC DLL Pin
Srikant Iyer1-Jul-11 2:46
MemberSrikant Iyer1-Jul-11 2:46 
QuestionC++ Pin
Karthik931730-Jun-11 21:36
MemberKarthik931730-Jun-11 21:36 
AnswerRe: C++ Pin
Richard MacCutchan30-Jun-11 23:35
mveRichard MacCutchan30-Jun-11 23:35 
AnswerRe: C++ Pin
Albert Holguin1-Jul-11 5:23
professionalAlbert Holguin1-Jul-11 5:23 
Questionfopen gives segmentation fault. Pin
krosty478230-Jun-11 19:44
Memberkrosty478230-Jun-11 19:44 
AnswerRe: fopen gives segmentation fault. Pin
enhzflep30-Jun-11 20:30
Memberenhzflep30-Jun-11 20:30 
AnswerRe: fopen gives segmentation fault. Pin
Chuck O'Toole30-Jun-11 21:24
MemberChuck O'Toole30-Jun-11 21:24 
QuestionGetting Static control styles [MFC] Pin
csrss30-Jun-11 10:58
Membercsrss30-Jun-11 10:58 
AnswerRe: Getting Static control styles [MFC] Pin
David Crow30-Jun-11 11:13
MemberDavid Crow30-Jun-11 11:13 
GeneralRe: Getting Static control styles [MFC] Pin
csrss30-Jun-11 11:23
Membercsrss30-Jun-11 11:23 
QuestionCEdit Control password style switch Pin
RomTibi30-Jun-11 8:06
MemberRomTibi30-Jun-11 8:06 
AnswerRe: CEdit Control password style switch Pin
User 742933830-Jun-11 8:30
professionalUser 742933830-Jun-11 8:30 
GeneralRe: CEdit Control password style switch Pin
RomTibi30-Jun-11 9:06
MemberRomTibi30-Jun-11 9:06 

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.