从未调用过WSASend完成例程

时间:2015-05-22 18:07:11

标签: c++ windows winsock winsock2 overlapped-io

我正在玩Overlapped IO并突然发现我看起来像是唯一一个不能鼓励完成回调工作的人(所有声明都是关于:它有效,我不喜欢它。)

我的应用程序的想法是:客户端(telnet localhost 27015)连接到服务器,服务器开始将大量数据推送到客户端。而且我从来没有调过CompletionCallback。

以下是代码:

> ~/local/python-2.7.9/bin/pip
Traceback (most recent call last):
  File "/root/local/python-2.7.9/bin/pip", line 9, in <module>
    load_entry_point('pip==7.0.0', 'console_scripts', 'pip')()
  File "/root/local/python-2.7.9/lib/python2.7/site-packages/distribute-0.6.49-py2.7.egg/pkg_resources.py", line 345, in load_entry_point
    return get_distribution(dist).load_entry_point(group, name)
  File "/root/local/python-2.7.9/lib/python2.7/site-packages/distribute-0.6.49-py2.7.egg/pkg_resources.py", line 2381, in load_entry_point
    return ep.load()
  File "/root/local/python-2.7.9/lib/python2.7/site-packages/distribute-0.6.49-py2.7.egg/pkg_resources.py", line 2087, in load
    entry = __import__(self.module_name, globals(),globals(), ['__name__'])
  File "/root/local/python-2.7.9/lib/python2.7/site-packages/pip-7.0.0-py2.7.egg/pip/__init__.py", line 15, in <module>
    from pip.vcs import git, mercurial, subversion, bazaar  # noqa
  File "/root/local/python-2.7.9/lib/python2.7/site-packages/pip-7.0.0-py2.7.egg/pip/vcs/subversion.py", line 9, in <module>
    from pip.index import Link
  File "/root/local/python-2.7.9/lib/python2.7/site-packages/pip-7.0.0-py2.7.egg/pip/index.py", line 30, in <module>
    from pip.wheel import Wheel, wheel_ext
  File "/root/local/python-2.7.9/lib/python2.7/site-packages/pip-7.0.0-py2.7.egg/pip/wheel.py", line 34, in <module>
    from pip._vendor.distlib.scripts import ScriptMaker
  File "/root/local/python-2.7.9/lib/python2.7/site-packages/pip-7.0.0-py2.7.egg/pip/_vendor/__init__.py", line 92, in load_module
    raise ImportError("No module named '%s'" % (name,))
ImportError: No module named 'pip._vendor.distlib.scripts'

谢谢。

1 个答案:

答案 0 :(得分:2)

alertable wait期间调用完成回调。你没有可警告的等待,所以完成回调排队,但永远不会有机会运行。

WaitForMultipleObjects更改为WaitForMultipleObjectsExSleepSleepEx的循环,并将TRUE作为bAlertable参数传递。

这在the WSASend documentation

中有解释
  

完成例程遵循与Windows文件I / O完成例程相同的规则。 在线程处于可警告的等待状态之前不会调用完成例程,例如当调用fAlertable参数设置为TRUE的函数WSAWaitForMultipleEvents时可能会发生。