I've been looking around for info about the Winsock 2 overlapped I/O model and aside from the confusing documentation in the PlatSDK I've turned up absolutely nothing. I swear it's as if Winsock programming is a highly guarded secret or something. It's been around for years but there are very few easy to read documents on it.
Well I broke down and I bought a book on it. So in two business days, maybe I won't be so confused. :x
In the mean time, has anybody out there found some good easy to understand documentation on the overlapped I/O in Winsock 2? I know it relies heavily on user defined callbacks but I've never been able to get anything to work.
Thanks!
-ib
Well I broke down and I bought a book on it. So in two business days, maybe I won't be so confused. :x
In the mean time, has anybody out there found some good easy to understand documentation on the overlapped I/O in Winsock 2? I know it relies heavily on user defined callbacks but I've never been able to get anything to work.
Thanks!
-ib
Overlapped I/O is the hardest winsock I/O to program.. I can't tell you much about it either. I've read some parts of the documentation about it in the platform sdk but not much.
However do you really need overlapped I/O? There are several other ways for handling the I/O and synchronisation, which are much easier to program than overlapped I/O. One way is to use events for notifications, this is one of the fastest methods, and not hard to program.
Overlapped I/O is the fastest but unless you're programming a server that needs to handle thousands of request, I'd recommend using something else.
Thomas
However do you really need overlapped I/O? There are several other ways for handling the I/O and synchronisation, which are much easier to program than overlapped I/O. One way is to use events for notifications, this is one of the fastest methods, and not hard to program.
Overlapped I/O is the fastest but unless you're programming a server that needs to handle thousands of request, I'd recommend using something else.
Thomas
Thomas,
I've used event objects and everything and it's nice, but I just want to learn it for the sake of learning it, you know? Plus one day I might indeed want to write a server app that can handle thousands of requests and I'd like to have this knowledge.
I broke down and ordered a book on it, and once it gets here I'll hopefully have what I need to understand it. If you or anybody else is interested I'll post my findings here.
I've used event objects and everything and it's nice, but I just want to learn it for the sake of learning it, you know? Plus one day I might indeed want to write a server app that can handle thousands of requests and I'd like to have this knowledge.
I broke down and ordered a book on it, and once it gets here I'll hopefully have what I need to understand it. If you or anybody else is interested I'll post my findings here.
For creation of the server it is more convenient to use I/O Completion Ports. You did not observe such alternative?
One thing at a time Nexo ;)
I think it's best to understand the Overlapped IO model first, before you can apply completion ports.
I think it's best to understand the Overlapped IO model first, before you can apply completion ports.
Having examined the OVERLAPPED structure in detail, it is apparent that it uses binary flags in the first two DWORDS to keep the state of the connection. We give it an Event Handle and it will Trigger under the right conditions.
This is remarkably similar to the relatively unknown WSAWaitForMultipleEvents function which uses the WSAEVENT structure to do exactly the same thing :|
This is remarkably similar to the relatively unknown WSAWaitForMultipleEvents function which uses the WSAEVENT structure to do exactly the same thing :|