精华内容
下载资源
问答
  • WSAGetLastError返回0

    千次阅读 2013-01-09 14:37:38
    最近使用wince开发的socket连接公网IP,发现一些情况下调用WSAGetLastError返回的结果为0,而0是socket正常的标志,而明明SOCKET_ERROR == nRet了,具体发现一部分调用返回10065之类的,而一部分返回0.后终于找到...
    最近使用wince开发的socket连接公网IP,发现一些情况下调用WSAGetLastError返回的结果为0,而0是socket正常的标志,而明明SOCKET_ERROR == nRet了,具体发现一部分调用返回10065之类的,而一部分返回0.后终于找到原因:int err=WSAGetLastError();的调用必须放到其他系统函数调用之前,也就是说,出现错误后,第一时间存储WSAGetLastError结果,而不能调用其他函数之后再调用此函数。因为调用系统函数会清除WSAGetLastError,致使结果返回0.
    
    展开全文
  • 最近使用wince开发的socket连接公网IP,发现一些情况下调用WSAGetLastError返回的结果为0,而0是socket正常的标志,而明明SOCKET_ERROR == nRet了,具体发现一部分调用返回10065之类的,而一部分返回0.后终于找到...

    最近使用wince开发的socket连接公网IP,发现一些情况下调用WSAGetLastError返回的结果为0,而0是socket正常的标志,而明明SOCKET_ERROR == nRet了,具体发现一部分调用返回10065之类的,而一部分返回0.后终于找到原因:int err=WSAGetLastError();的调用必须放到其他系统函数调用之前,也就是说,出现错误后,第一时间存储WSAGetLastError结果,而不能调用其他函数之后再调用此函数。因为调用系统函数会清除WSAGetLastError,致使结果返回0.

    手机csdn发布文章后无法返回问题:先点文章编辑的返回,再点最左上角整个页面的返回。

    展开全文
  • 就是在线程里 GetQueuedCompletionStatus 返回都是0WSAGetLastError() = 998 创建代码: m_hCompletionPort = CreateIoCompletionPort(INVALID_HANDLE_VALUE, NULL, 0, 1); if (NULL == m_hCompletionPort)...
  • socket创建失败,WSAGetLastError返回0,偶尔会出现这样正常吗? DWORD _stdcall thread(LPVOID lp) { SOCKET _socket; _socket = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP); if (SOCKET_ERROR ==...
  • 为什么会这样?我发送的数据很大,缓冲区一般都是满的 跟这个会有关系吗?
  • WSAGetLastError()返回码

    千次阅读 2013-12-09 12:15:23
    WSAGetLastError()返回码 Socket error 0 - Directly send error Socket error 10004 - Interrupted function call Socket error 10013 - Permission denied Socket error 10014 - Bad address

    WSAGetLastError()返回码

    Socket error 0 - Directly send error

    Socket error 10004 - Interrupted function call

    Socket error 10013 - Permission denied
    Socket error 10014 - Bad address
    Socket error 10022 - Invalid argument
    Socket error 10024 - Too many open files
    Socket error 10035 - Resource temporarily unavailable
    Socket error 10036 - Operation now in progress
    Socket error 10037 - Operation already in progress
    Socket error 10038 - Socket operation on non-socket
    Socket error 10039 - Destination address required
    Socket error 10040 - Message too long
    Socket error 10041 - Protocol wrong type for socket
    Socket error 10042 - Bad protocol option
    Socket error 10043 - Protocol not supported
    Socket error 10044 - Socket type not supported
    Socket error 10045 - Operation not supported
    Socket error 10046 - Protocol family not supported
    Socket error 10047 - Address family not supported by protocol family
    Socket error 10048 - Address already in use
    Socket error 10049 - Cannot assign requested address
    Socket error 10050 - Network is down
    Socket error 10051 - Network is unreachable
    Socket error 10052 - Network dropped connection on reset
    Socket error 10053 - Software caused connection abort
    Socket error 10054 - Connection reset by peer
    Socket error 10055 - No buffer space available
    Socket error 10056 - Socket is already connected
    Socket error 10057 - Socket is not connected
    Socket error 10058 - Cannot send after socket shutdown
    Socket error 10060 - Connection timed out
    Socket error 10061 - Connection refused
    Socket error 10064 - Host is down
    Socket error 10065 - No route to host
    Socket error 10067 - Too many processes
    Socket error 10091 - Network subsystem is unavailable
    Socket error 10092 - WINSOCK.DLL version out of range
    Socket error 10093 - Successful WSAStartup not yet performed
    Socket error 10094 - Graceful shutdown in progress
    Socket error 11001 - Host not found
    Socket error 11002 - Non-authoritative host not found
    Socket error 11003 - This is a non-recoverable error
    Socket error 11004 - Valid name, no data record of requested type
    WSAEADDRINUSE (10048) Address already in use
    WSAECONNABORTED (10053) Software caused connection abort
    WSAECONNREFUSED (10061) Connection refused
    WSAECONNRESET (10054) Connection reset by peer
    WSAEDESTADDRREQ (10039) Destination address required
    WSAEHOSTUNREACH (10065) No route to host
    WSAEMFILE (10024) Too many open files
    WSAENETDOWN (10050) Network is down
    WSAENETRESET (10052) Network dropped connection
    WSAENOBUFS (10055) No buffer space available
    WSAENETUNREACH (10051) Network is unreachable
    WSAETIMEDOUT (10060) Connection timed out
    WSAHOST_NOT_FOUND (11001) Host not found
    WSASYSNOTREADY (10091) Network sub-system is unavailable
    WSANOTINITIALISED (10093) WSAStartup() not performed
    WSANO_DATA (11004) Valid name, no data of that type
    WSANO_RECOVERY (11003) Non-recoverable query error
    WSATRY_AGAIN (11002) Non-authoritative host found
    WSAVERNOTSUPPORTED (10092) Wrong WinSock DLL version
    展开全文
  • sendto发送显示正常,返回值>0, WSAGetLastError返回值也是0,但是抓包,什么数据都没有~~~ 谁知道这个是什么问题,由什么造成的?
  • int err = WSAGetLastError(); if(err != WSA_IO_PENDING){ SetErrorString(_T("IO_TYPE_ACCEPT出错!")); return FALSE; } } pHandleData->pIOData = pIoData; return TRUE; }
  • int ret; ret = WSAStartup(VersionReqd, &wsadata); if (ret != 0){ wshout_err ( WSAGetLastError(), "WSAStartup()"); }
    	int ret;
    	ret = WSAStartup(VersionReqd, &wsadata);
    	if (ret != 0){
    	wshout_err ( WSAGetLastError(), "WSAStartup()");
    	}

    展开全文
  • 问题现象:今天写一个socket服务端,客户端connect成功,服务端accept成功,能接收... ret1= send(sd, buf, 4, 0); ret2 =WSAGetLastError(); ret1返回-1,ret2返回10057,网上说10057是未连接,但的确是连接了,...
  • int err; char msgbuf [256]; // for a message up to 255 bytes. ...msgbuf [0] = '\0'; // Microsoft doesn't guarantee this on man page. err = WSAGetLastError (); FormatMessage (FORMAT_MESSAGE...
  • 本文转载:... 1 0 0 0 4 —W S A E I N T R  函数调用中断。该错误表明由于对W S A C a n c e l B l o c k i n g C a l l 的调用,造成了一次调用被强  行中断。  1 0 0 0 9
  • GetLastError()(WSAGetLastError())的返回值

    千次阅读 2018-05-26 11:11:17
    0〗-操作成功完成。 〖1〗-功能错误。 〖2〗-系统找不到指定的文件。 〖3〗-系统找不到指定的路径。 〖4〗-系统无法打开文件。 〖5〗-拒绝访问。 〖6〗-句柄无效。 〖7〗-存储控制块被损坏。 〖8〗-存储...
  • 1:windows下C++网络编程,发送组播报文,sendto()函数发送失败,WSAGetLastError()返回错误码为5 2:代码如下: // WinsockServer_1.cpp : Defines the entry point for the console application. // #...
  • WSAGetLastError() returned 0 (0) recv_function_udp: Received 388 bytes. - calling sctp_common_input_processing with off=12 Ok, Common input processing called, m:0000000000DE9E00 iphlen:0 offset:12...
  • socket返回SOCKET_ERROR但是errno为0

    千次阅读 2017-02-24 20:23:15
    Because you are working with Windows sockets, you will need to use the WSAGetLastError() function to check the error code.
  • 在Mingw stdio上编译Windows Socket程序经常出现这样的错误 undefined reference to `inet_addr@4' undefined reference to `...undefined reference to `WSAGetLastError@0' undefined reference to `inet_ntoa@
  • if( icmpHdrRet->byCode == 0 && icmpHdrRet->nId == pIcmpHeader->nId && icmpHdrRet->nSequence == pIcmpHeader->nSequence) { nPacketReceived++; unsigned long dwRecvTime = ::GetTickCount(); int ...
  • 如果连接已中止,返回0。否则的话,返回SOCKET_ERROR错误,应用程序可通过WSAGetLastError()获取相应错误代码。 如无错误发生,listen()返回0。否则的话,返回SOCKET_ERROR错误,应用程序可通过WSAGetLastError()...
  • len = recvfrom(serverListen, bufRecv1, sizeof(bufRecv1), 0,(struct sockaddr*)&sourceAddr1,&sourceAddrLen1); if (len == SOCKET_ERROR) { printf("recv() failed:%d\n", WSAGetLastError()); return...
  • 函数返回时,大多数Windows Sockets 2函数都不会返回错误的具体原因。... 对于返回句柄的Winsock函数,返回值INVALID_SOCKET(0xffff)表示错误,并且可以通过调用WSAGetLastError来检索特定错误号。 ...
  • WSAGetLastError() select出错就直接打印select的返回值 例子: ret = select(connfd +... 0)//Select出错 { printf("ret=%d\n", ret); printf("Fail to select!%d\n",WSAGetLastError()); break; } ...
  • SOCKET soka= recv(son2, hnp, sizeof(hnp) - 1, 0); if (soka == SOCKET_ERROR) { cout 错误码是:" << WSAGetLastError() ; return ; } cout ; } int main() { WSADATA wd; WSAStartup(0x...
  • recv接收问题,急急急急

    千次阅读 2007-07-24 13:40:00
    导读: while ((rcvlen = recv(sock, bufptr, buflen, 0)) { if (wsagetlasterror() != wsaewouldblock) { error("socket failed - %d/r/n", wsagetlasterror()); goto rdperror; /* tcp error */ } else { int x =
  • if(0 != WSAStartup(wVersionRequested, &wsaData)) { printf("WSAStartup failed with error: %d/n", GetLastError()); return EXIT_FAILURE; } if(2 != HIBYTE(wsaData.wVersion) || 2 != LOBYTE...
  • printf("setsockopt failed with error%d\n",WSAGetLastError()); return 0; } memset(&DestAddr,0,sizeof(DestAddr)); DestAddr.sin_addr.s_addr=inet_addr(DestIpAddr); DestAddr.sin_port =htons(0); DestAddr....
  • WINDOWS网络API总结

    千次阅读 2018-06-16 20:58:23
    WinSock APIWSAStartup,getaddrinfo,socket,connect,send,recv,WSAGetLastError二:WinINet APIInternetOpen:初始化一个应用程序,以使用 WinINet 函数InternetConnect:建立 Internet 的连接,成功返回非0。...

空空如也

空空如也

1 2 3 4 5 ... 9
收藏数 163
精华内容 65
关键字:

0wsagetlasterror