IOCP Server Example

Dec 26, 2015 at 3:18pm
Hello. I've been reading about IOCP technology and want to implement it in my project. I've checked codeproject article source but there're about 4k lines only in server class so I was wondering if someone could hook me up with a example that will take things from start and provide minimal code example. Thanks in advance.
Dec 26, 2015 at 9:42pm
The code that goes with this is around 500 lines + you get a good explanation and clean clear code.
http://www.drdobbs.com/cpp/multithreaded-asynchronous-io-io-comple/201202921
Dec 26, 2015 at 10:19pm
@kbw Thanks a bunch. There's a comment on almost each operation too. One question though, as far as I can tell it's using TransmitFile instead of WSASend/WSARecv. The server I'm aiming to implement IOCP won't be sending/receiving big amouns of data. Also here: https://support.microsoft.com/en-us/kb/192800 it says:
"Use Winsock2 IOCP-capable functions, such as WSASend and WSARecv, over Win32 file I/O functions, such as WriteFile and ReadFile. "
Would I be able to use respective winsock functions deriving from that example. I'd be willing to use TransmitFile as well if it's offering better performance without any drawbacks.
Dec 27, 2015 at 3:21pm
TransmitFile is the fastest way to get a file onto a file down a socket, in the same way CopyFile is the fastest way to duplicate a file.

It's equivalent to sendfile on Unix, I mean POSIX.

https://msdn.microsoft.com/en-us/library/windows/desktop/ms740565%28v=vs.85%29.aspx
https://www.freebsd.org/cgi/man.cgi?query=sendfile&sektion=2
https://msdn.microsoft.com/en-us/library/windows/desktop/aa363851%28v=vs.85%29.aspx
Last edited on Dec 27, 2015 at 3:22pm
Topic archived. No new replies allowed.