0

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?

John
  • 1,049
  • 1
  • 14
  • 34

3 Answers3

1

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.

usr
  • 168,620
  • 35
  • 240
  • 369
1

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".

franji1
  • 3,088
  • 2
  • 23
  • 43
1

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.

Len Holgate
  • 21,282
  • 4
  • 45
  • 92
  • [Overlapped I/O](https://msdn.microsoft.com/en-us/library/aa365683.aspx) and [I/O Completion Ports](https://msdn.microsoft.com/en-us/library/aa365198.aspx) are not the same thing. You can - and often do - perform overlapped I/O with synchronization objects other than IOCPs. – IInspectable Mar 20 '15 at 21:16
  • True, but that doesn't invalidate my answer at all. – Len Holgate Mar 20 '15 at 21:34
  • The question asks specifically about asynchronous I/O. Your answer only addresses this in so far as IOCPs are **one** way to synchronize asynchronous I/O. It doesn't address the question directly. – IInspectable Mar 20 '15 at 21:39
  • IOCP based I/O is asynchronous, it's as useful in clients as it is in servers. That's what my answer says. You may view it as an incomplete answer, but I don't view the alternative asynchronous I/O methods as being something worth using. – Len Holgate Mar 20 '15 at 21:45