请问:SCO UNIX下SOCKET的recv返回-1,errno=9?在线等·····

请问:SCO UNIX下SOCKET的recv返回-1,errno=9?在线等·····
---------------------------------------------------------------

perror吧,一般返回-1说明无法读取
---------------------------------------------------------------

errno=9:Bad file number
---------------------------------------------------------------

recv函数中的socket id非法
---------------------------------------------------------------

recv返回-1说明调用该函数出错或者接收数据出错。
errno=9 说明 Bad file number ,即文件或socket描述字非法。
从这来看,应该是你的socket描述字不正确,该描述字是在调用socket或者accept时获取得,注意捕获错误,如果小于0则出错。

---------------------------------------------------------------

“Bad file number” 在GOOGLE中可以找到更详细的资料

Published At
Categories with 服务器类
Tagged with
comments powered by Disqus