Reputation: 1119
I think that Overlapped I/O was invented to be used on the server side, mainly to be able to handle thousands of clients. So I do not think that there is any reason to use it on the client side. is my assumption correct?
Upvotes: 0
Views: 214
Reputation: 21616
The code required to write an IOCP based server is 95% the same as the code required to write a client. The only differences are connection establishment, ConnectEx
vs AcceptEx
.
IMHO there's no reason not to use IOCP for client side communications.
Upvotes: 1
Reputation: 3156
Are you assuming that a client only needs 1 connection at a time? A "simple" browser could have 10 pages open, downloading 10 files, playing 10 videos, etc. Overlapped I/O would be a great way for a client to remain "responsive".
Upvotes: 1
Reputation: 171178
This is not a client/server issue. It's a workload issue. Clients just normally don't have any reason to keep many IOs outstanding at the same time. That's the main use case for async IO.
A port scanner would be an example of a good case for async IO on the client.
Upvotes: 1