Search code examples
windowssocketsasynchronousasyncsocketoverlapped-io

will socket async operation ever complete synchronously?


According to http://support.microsoft.com/kb/156932 there are conditions under which an asynchronous Disk IO operation may complete synchronously. Is this only applicable to Disk IO or can similar conditions apply to Network IO?

UPDATE: i've tested this now with the debugger and have verified that 1) if there is data in the receive buffer the operation will complete synchronously 2) the IOCP will fire a callback regardless.


Solution

  • Certainly, if for example you're reading data that is already present in the socket receive buffer. The real question is what difference would it make to you?