Request iocp Code
Re: Request iocp Code
Fred, in another post to you, wrote:Such topic without any english-like question will be locked
I compile using 5.31 (x86) on Win 7 Ultimate (64-bit).
"PureBasic won't be object oriented, period" - Fred.
"PureBasic won't be object oriented, period" - Fred.
- Rook Zimbabwe
- Addict
- Posts: 4322
- Joined: Tue Jan 02, 2007 8:16 pm
- Location: Cypress TX
- Contact:
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.
@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.
Idle, you forgot "but we need you to send us $250 in advance to cover our banking fees"


Last edited by pdwyer on Fri Dec 26, 2008 8:09 am, edited 1 time in total.
Paul Dwyer
“In nature, it’s not the strongest nor the most intelligent who survives. It’s the most adaptable to change” - Charles Darwin
“If you can't explain it to a six-year old you really don't understand it yourself.” - Albert Einstein
“In nature, it’s not the strongest nor the most intelligent who survives. It’s the most adaptable to change” - Charles Darwin
“If you can't explain it to a six-year old you really don't understand it yourself.” - Albert Einstein
Basically when you use IOCP you are letting the OS manage your IO requests. For both in OS and application IORings wrote:seems garbage or very bad english
moved to 'off topic'
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..
- netmaestro
- PureBasic Bullfrog
- Posts: 8452
- Joined: Wed Jul 06, 2005 5:42 am
- Location: Fort Nelson, BC, Canada
@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?
http://www.codeguru.com/forum/archive/i ... 02250.html
it would be good form to give him the credit, don't you think?
BERESHEIT
- netmaestro
- PureBasic Bullfrog
- Posts: 8452
- Joined: Wed Jul 06, 2005 5:42 am
- Location: Fort Nelson, BC, Canada
Maybe he is Matthew Joy!
Everyone is entitled to defend themselves
(But the prosecution have a pretty strong case at the moment
)

Everyone is entitled to defend themselves

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

Paul Dwyer
“In nature, it’s not the strongest nor the most intelligent who survives. It’s the most adaptable to change” - Charles Darwin
“If you can't explain it to a six-year old you really don't understand it yourself.” - Albert Einstein
“In nature, it’s not the strongest nor the most intelligent who survives. It’s the most adaptable to change” - Charles Darwin
“If you can't explain it to a six-year old you really don't understand it yourself.” - Albert Einstein