中国开发网: 论坛: 程序员情感CBD: 贴子 366257
bjwf
从理论上来讲,在多cpu时,一次提交多个recv,似乎是无法确定收到的数据顺序的.
比如服务器有两个cpu提交了两 个recv,客户端发了两个字节,
第一个字节被第一个recv1收到,后一个字节被recv2收到,但是根据这段理论,

All overlapped operations are guaranteed to be executed in the order that the application issued them. However, the completion notifications returned from a completion port are not guaranteed to be in that same order.That is, if an application posts two overlapped WSARecv operations, one with a 10 KB buffer and the next with a 12 KB buffer, the 10 KB buffer is filled first, followed by the 12 KB buffer. The application's worker thread may receive notification from GetQueuedCompletionStatus for the 12 KB WSARecv before the completion event for the 10 KB operation. Of course, this is only an issue when multiple operations are posted on a socket.

windows有可能先触发 recv2的完成通知给cpu2上的工作线程,后触发rcv1的完成通知给cpu1上的工作线程,这样的话,服务器程序永远也不知道哪个字节应该在前面哪个字节应该在后面了.
试图在互联网上划出国界的举动是愚蠢的!!!
把人当成猪羊圈养,草料永远都不够!把人当人待,人有无限的创造力! “人口减少一半,人们两倍富有”的观念为“一种非常糟糕的自甘堕落—这背后的潜台词是,似乎中国人是封闭围栏中的动物,对周围那些自己赖以生存的资源,除了咀嚼,别无办法。”

我的像册:http://picasaweb.google.com/bjwf2000/
我的主页: http://bjwf2000.googlepages.com/

相关信息:


欢迎光临本社区,您还没有登录,不能发贴子。请在 这里登录