Synchronous and asynchronous terminology when it comes to sockets

I don’t quite understand what it means when they say something like: “ asynchronous read and write operations” or “ synchronous read and write operations”.

I will give examples to demonstrate my understanding of terminology and to correct if I am mistaken:

  • Reading and writing to a socket in lock mode is considered synchronous.
  • Reading and writing to a socket in non-blocking mode is considered asynchronous.
  • Reading and writing to a socket using Overlapped I / O is considered asynchronous.
+6
source share
3 answers

Reading and writing to a socket in lock mode is considered synchronous.

Yes.

Reading and writing to a socket in non-blocking mode is considered asynchronous.

No. It is synchronous. The operation completes or fails in the current thread.

Reading and writing to a socket using Overlapped I / O is considered asynchronous.

Right. A function call performs an operation that is performed, which is performed independently of the current thread, and a later operation is required to complete its success or failure, or there is a completion callback.

+4
source

No. The non-blocking socket operation is synchronous.

On Windows, "I / O overlap" is synonymous with "asynchronous I / O."

+2
source

I think of it as a calling thread of execution.

Synchronous means that the calling thread of execution is "synchronized" with the operation. Therefore, when the call returns, the calling thread has data from the operation available for use.

Asynchronous means that the calling thread of execution is not synchronized with the operation. Therefore, when the calling thread returns from the operation, it may have data from the operation or cannot; he must deal with both cases.

0
source

Source: https://habr.com/ru/post/982916/


All Articles