我不完全理解他们所说的“异步读写操作”或“同步读写操作”是什么意思。
我将举例说明我对术语的理解,如果我错了请更正:
- 以阻塞模式在套接字上读写被认为是同步的。
- 以非阻塞模式在套接字上读写被认为是异步的。
- 使用重叠 I/O 在套接字上读写被认为是异步的。
最佳答案
Read and write on a socket in a blocking mode is considered synchronous.
是的。
Read and write on a socket in a non-blocking mode is considered asynchronous.
没有。它是同步的。操作在当前线程内联完成或失败。
Read and write on a socket using Overlapped I/O is considered asynchronous.
正确。函数调用发布要完成的操作,它独立于当前线程进行,需要稍后的操作来确定其成功或失败,或者有完成回调。
关于c++ - 谈论套接字时的同步和异步术语,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28684944/