首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 开发语言 > VC/MFC >

调用listen(m_socket,5);函数出现的有关问题

2012-01-30 
调用listen(m_socket,5)函数出现的问题lastcodeWSAGetLastError()wsprintf(szOut,szout%ld ,lastcod

调用listen(m_socket,5);函数出现的问题
lastcode=WSAGetLastError();
wsprintf(szOut,   "szout=%ld ",   lastcode);
MessageBox(szOut);


用WSAGetLastError();取得最后的代码   10045

The   attempted   operation   is   not   supported   for   the   type   of   object   referenced.  
由于参考对象的类型,试图尝试的操作不被支持
Usually   this   occurs   when   a   socket   descriptor   to   a   socket   that   cannot   support   this   operation   is   trying   to   accept   a   connection   on   a   datagram   socket.
通常出现这种情况是当套接口到套接口不能支持这种试图在数据包接口连接的操作

[解决办法]
意思是说,如果数据报协议不支持监听,如果你使用的是UDP,是不支持listen和accept的。

热点排行