易截截图软件、单文件、免安装、纯绿色、仅160KB

发现select做延时windows没效果,Linux正常

 在完善我的跨平台的发邮件类库时,select做延时windows没效果,Linux正常,还以为我代码写错了呢;在网上搜素下也没发现类似说法,于是我就写了段小测了,果然select延时在windows上缩水了
#include <iostream>
#include <time.h>
#ifdef WIN32
#include <winsock2.h>
#pragma comment(lib,"ws2_32.lib")
#else
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#endif
using namespace std;
int  main()
{
        struct timeval timeWait;
        timeWait.tv_sec = 0;
        timeWait.tv_usec = 10000;
        int liRecvCnt = 0;
        time_t t1, t2;
        time(&t1);
         while(liRecvCnt < 10)
         {
                timeWait.tv_sec = 0;
                timeWait.tv_usec = 500000;
                liRecvCnt++;
                select(0, NULL, NULL, NULL, &timeWait);
        }
         time(&t2);
         cout<<t2-t1<<endl;
         return 0;
}
在VS2005上输出是 0
在Linux上输出是 5 S
你有什么想法,敬请留言
QQ:16645709


相关文档:

linux网址精选

 linux网址精选
http://hi.baidu.com/digast/blog/item/31cd94efba1348ebcf1b3ed3.html
2008-04-01 14:57
国外
  http://lwn.net/
  http://www.tldp.org/
  https://rhn.redhat.com
  http://www.justlinux.com/
  http://www.linuxtoday.com/
  http://www.linuxquestions.org/
  http://ww ......

Linux学习高手写给初学者的经验谈

 Linux学习高手写给初学者的经验谈
2008-04-01 15:02
    现在好多的人开始接触电脑的时候,见到的应该是Windows98说实话,98 已经是一个很人性化,封装的很好的一个系统了一个对电脑一窍不通的人都能很快的使用它。这样很多人对 "电脑"的印象和那些和我一样一开始接触的是DOS人是绝然不同的。在DO ......

linux 开机自动运行

 引用http://blog.csdn.net/johnny_mcoc/archive/2008/05/15/2447174.aspx
document.body.oncopy = function() {
if (window.clipboardData) {
setTimeout(function() {
var text = clipboardData.getData("text");
if (text && text.length>300) ......

linux网桥模式vlantrunk透传

 linux网桥模式vlantrunk透传
2007-12-27 08:30
首先使用vconfig创建vlan虚拟接口,并分别在两个接口上增加vlan100\vlan200\vlan300
vconfig add eth0 100
vconfig add eth0 100 
vconfig add eth0 300
vconfig add eth1 100
vconfig add eth1 200
vconfig add eth1 300
启用vlan端口
ifconfig eth0.10 ......

Linux 下 Squid 安装

目录
 
一、确保Linux 系统中装有NET-SNMP 协议... 1
1.Net-snmp 获取与安装... 1
2.Net-snmp 的配置... 1
3.Net-snmp 常用命令... 2
二、Squid. 3
1.检查linux是否存在squid老版本... 3
2.Squid 获取与安装... 3
3.Squid 配置... 4
4.Squid 测试... 4
5.Squid 常用命令... 5
6.Squid 其他... 6
7.Squid. ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号