Page 1 of 2

Request iocp Code

Posted: Fri Dec 26, 2008 5:23 am
by Rascal
Request iocp Code

Re: Request iocp Code

Posted: Fri Dec 26, 2008 5:32 am
by PB
Fred, in another post to you, wrote:Such topic without any english-like question will be locked

Posted: Fri Dec 26, 2008 6:10 am
by pdwyer

Posted: Fri Dec 26, 2008 6:44 am
by Rook Zimbabwe
request large amounts of cash and gold bullion... NOPE... don't see that either!

Posted: Fri Dec 26, 2008 7:14 am
by idle
Request Granted

@rook

please send us your bank account number , password, DOB, mothers maiden name and we'll send you $100,000,000 because your great, great... aunt from Nigeria, whom you never knew, or heard of, but of whom we're sure has a 99% DNA match with you and er everyone else for that matter, recently passed away and left you $100,000,000 dollars.

Posted: Fri Dec 26, 2008 7:40 am
by pdwyer
Idle, you forgot "but we need you to send us $250 in advance to cover our banking fees"

:P

Posted: Fri Dec 26, 2008 7:51 am
by idle
:lol:

Posted: Fri Dec 26, 2008 7:53 am
by Rings
seems garbage or very bad english
moved to 'off topic'

Posted: Fri Dec 26, 2008 8:07 am
by pdwyer
Shameless plug! ;)

Posted: Fri Dec 26, 2008 11:56 am
by Mohawk70
Rings wrote:seems garbage or very bad english
moved to 'off topic'
Basically when you use IOCP you are letting the OS manage your IO requests. For both in OS and application IO
requests management is a complicated thing. If you let your application wait till the IO is complete, you loose
performance. Now if you are not waiting (doing it asynchronously) you should have some sort of mechanism
to know when your IO is complete. If you poll continuously, you loose efficiency, because much of the CPU cycle
is wasted looking if the IO is over or not. Now if you poll slowly you loose/compromise response time. There are
many ways of managing IO and one is using completion port.

So what you basically do is you create a completion port and associate handles to it (for instance SOCKET
handles). Now for each asynchronous IO (usually using overlapped IO) that you do on that handle, you get notification
on that port when it is over. So now your problem reduces to retrieving the notification as quickly as possible.
Completion port is nothing but a FIFO queue maintained by the OS.

The IOCP model is very efficient. It is scalable and do have multiprocessor support. IOCP handles the thread pool, no.
of concurrent running threads etc. The complexity is high as well (compared to the other models). In the context of
writing a server, you usually use this model when you have to maintain tens and thousands of connections. It is not
worth the time if you are writing a complex server code that uses IOCP model just for a few (maybe hundred) connections.

You can look up in the MSDN for APIs such as CreateIoCompletionPort(), GetQueuedCompletionStatus() etc..

Posted: Fri Dec 26, 2008 1:06 pm
by SFSxOI
@Rook Zimbabwe

Your wish has been granted, just respond to the email from the guy in Nigeria. He has your funds on deposit in a bank and only needs a little help from you to make sure you get what is yours.

:)

Posted: Fri Dec 26, 2008 2:34 pm
by netmaestro
@Mohawk70: If you're going to quote Matthew Joy word for word from here:

http://www.codeguru.com/forum/archive/i ... 02250.html

it would be good form to give him the credit, don't you think?

Posted: Fri Dec 26, 2008 2:38 pm
by srod
Busted!

:lol: :lol:

Posted: Fri Dec 26, 2008 2:47 pm
by netmaestro
Hehe, if you're going to steal something at least paraphrase. :wink: Of course the problem comes in when someone asks you to explain a portion in greater depth, then you're cooked.

Posted: Fri Dec 26, 2008 3:54 pm
by pdwyer
Maybe he is Matthew Joy! :D

Everyone is entitled to defend themselves 8)

(But the prosecution have a pretty strong case at the moment ;) )