| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 903 人关注过本帖
标题:Winsock 大神有没有,求助一个问题
取消只看楼主 加入收藏
NiuYoohoo
Rank: 4
等 级:业余侠客
威 望:2
帖 子:65
专家分:216
注 册:2016-10-8
结帖率:75%
收藏
已结贴  问题点数:20 回复次数:3 
Winsock 大神有没有,求助一个问题
在看RTSP 协议的时候有个问题 就是套接字的值和 [0,10000) 直接有啥关系么??

  fprintf(stderr, "socket numbers used in the select() call:");
    for (int i = 0; i < 10000; ++i) {
      if (FD_ISSET(i, &fReadSet) || FD_ISSET(i, &fWriteSet) || FD_ISSET(i, &fExceptionSet)) {
        fprintf(stderr, " %d(", i);
        if (FD_ISSET(i, &fReadSet)) fprintf(stderr, "r");
        if (FD_ISSET(i, &fWriteSet)) fprintf(stderr, "w");
        if (FD_ISSET(i, &fExceptionSet)) fprintf(stderr, "e");
        fprintf(stderr, ")");
      }
    }

图片为MSDN对socket 返回值的描述!
图片附件: 游客没有浏览图片的权限,请 登录注册

2017-04-18 17:33
NiuYoohoo
Rank: 4
等 级:业余侠客
威 望:2
帖 子:65
专家分:216
注 册:2016-10-8
收藏
得分:0 


WSA_INVALID_HANDLE
6
 

Specified event object handle is invalid.

    An application attempts to use an event object, but the specified handle is not valid. Note that this error is returned by the operating system, so the error number may change in future releases of Windows.

WSA_NOT_ENOUGH_MEMORY
8
 

Insufficient memory available.

    An application used a Windows Sockets function that directly maps to a Windows function. The Windows function is indicating a lack of required memory resources. Note that this error is returned by the operating system, so the error number may change in future releases of Windows.

WSA_INVALID_PARAMETER
87
 

One or more parameters are invalid.

    An application used a Windows Sockets function which directly maps to a Windows function. The Windows function is indicating a problem with one or more parameters. Note that this error is returned by the operating system, so the error number may change in future releases of Windows.

WSA_OPERATION_ABORTED
995
 

Overlapped operation aborted.

    An overlapped operation was canceled due to the closure of the socket, or the execution of the SIO_FLUSH command in WSAIoctl. Note that this error is returned by the operating system, so the error number may change in future releases of Windows.

WSA_IO_INCOMPLETE
996
 

Overlapped I/O event object not in signaled state.

    The application has tried to determine the status of an overlapped operation which is not yet completed. Applications that use WSAGetOverlappedResult (with the fWait flag set to FALSE) in a polling mode to determine when an overlapped operation has completed, get this error code until the operation is complete. Note that this error is returned by the operating system, so the error number may change in future releases of Windows.

WSA_IO_PENDING
997
 

Overlapped operations will complete later.

    The application has initiated an overlapped operation that cannot be completed immediately. A completion indication will be given later when the operation has been completed. Note that this error is returned by the operating system, so the error number may change in future releases of Windows.

1000以下都是异常值没错,但是这样写也太。。。
2017-04-18 17:37
NiuYoohoo
Rank: 4
等 级:业余侠客
威 望:2
帖 子:65
专家分:216
注 册:2016-10-8
收藏
得分:0 
回复 3楼 吹水佬
总共就6个异常值,每次都遍历10000 有必要么!
2017-04-19 08:57
NiuYoohoo
Rank: 4
等 级:业余侠客
威 望:2
帖 子:65
专家分:216
注 册:2016-10-8
收藏
得分:0 
回复 6楼 吹水佬
我也想知道为何要遍历 为啥一个find_if 或者contain轻而易举的事情为何要遍历!
2017-04-19 11:41
快速回复:Winsock 大神有没有,求助一个问题
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.024422 second(s), 10 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved