最近学习重叠IO,有些地方不太理解 望指点。。
1. 在重叠IO中使用普通的socket、accept 和 使用WSASocket AcceptEx有什么区别吗?
书上说用重叠IO创建SOCKET时候必须指定WSA_FLAG_OVERLAPPED标志,也就是用WSASocket ,但是http://tangfeng.iteye.com/blog/518146 这篇博文上的例子却直接用的socket 这样运行起来也没啥问题2.都说重叠IO比 select WSAEventSelect什么的优秀,但是代码上每次事件投递之后,不也得用WSAWaitForMultipleEvents阻塞线程来等待信号吗? MSDN上貌似说这个函数不占CPU时间? 但是程序卡在那的TIMEOUT时间内 也做不了什么其他事吧
重叠应该如何理解?

解决方案 »

  1.   

    socket api默认创建重叠socket.
      

  2.   

    看<windows核心编程>就明白了.
      

  3.   

    socket 是1.1版
    WSASocket 是2.2版
    1.1版默认为非阻塞模式
    2.2版需人工指定通讯模式
      

  4.   

    The socket function causes a socket descriptor and any related resources to be allocated and bound to a specific transport-service provider. Winsock will utilize the first available service provider that supports the requested combination of address family, socket type and protocol parameters. The socket that is created will have the overlapped attribute as a default.