本文介绍了为什么显示10014套接字错误?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述 我有一个问题,那就是10014 erorr !! 我尝试检查内存和套接字值,您对此有何看法? 我要做什么?请帮帮我....... 我尝试过的事情: i have one problem , that is 10014 erorr!!i try check memory and socket values , what are you think about this? what i have to do ? please help me ....!What I have tried:#include "cUDPReceiver.h"cUDPReceiver::cUDPReceiver(void){}cUDPReceiver::~cUDPReceiver(void){}void cUDPReceiver::Initializing(SOCKET_socket ){m_socket = _socket;ZeroMemory(&m_overlapped,sizeof(m_overlapped));m_nFlags = 0;m_wsaBuf.len= BUF_SIZE;m_wsaBuf.buf= m_buf;OnRecv();}void cUDPReceiver::OnRecv(){DWORD dwBytes = 0, dwFlags = 0;int returnValue = 0;ZeroMemory(&m_overlapped,sizeof(m_overlapped));ZeroMemory(&m_lastSenderAddr,sizeof(m_lastSenderAddr));m_addrSize = sizeof(m_lastSenderAddr);m_wsaBuf.buf= m_queueBuffer.GetBufferPoint();m_wsaBuf.len= m_queueBuffer.GetRecvBytes();__LOCK;returnValue = WSARecvFrom(m_socket,&m_wsaBuf,1,&dwBytes,&dwFlags,(SOCKADDR *)&m_lastSenderAddr,&m_addrSize, &m_overlapped,NULL);__UNLOCK;if ( returnValue == SOCKET_ERROR ){if( WSAGetLastError() != WSA_IO_PENDING ){//WSACleanup();OnRecv();}}}void cUDPReceiver::OnSend(SOCKADDR_IN_addr, char* pData,const int _nSize){DWORD dwBytes = 0;int returnValue = 0;__LOCK;m_wsaBuf.buf = pData;m_wsaBuf.len = _nSize; returnValue = WSASendTo(m_socket, &m_wsaBuf, 1,&dwBytes, 0, (SOCKADDR *) & _addr,sizeof(_addr), &m_overlapped, NULL);__UNLOCK;if( returnValue == SOCKET_ERROR){if(WSAGetLastError() != WSA_IO_PENDING){printf("Error - fail wsasend \n");}}}void cUDPReceiver::SetLength(DWORD _dwSize){m_wsaBuf.len = _dwSize;m_queueBuffer.PushData(_dwSize);}char*cUDPReceiver::GetBuffer(){return m_queueBuffer.PopData();}SOCKADDR_IN cUDPReceiver::GetLastAddr(){return m_lastSenderAddr;}void cUDPReceiver::Dispatch(char* pData){} 推荐答案 引用: WSAEFAULT 10014 地址错误。 系统在尝试时检测到无效的指针地址使用调用的指针参数。如果应用程序传递无效指针值,或者缓冲区的长度太小,则会发生此错误。例如,如果参数的长度(sockaddr结构)小于sizeof(sockaddr)。WSAEFAULT10014Bad address.The system detected an invalid pointer address in attempting to use a pointer argument of a call. This error occurs if an application passes an invalid pointer value, or if the length of the buffer is too small. For instance, if the length of an argument, which is a sockaddr structure, is smaller than the sizeof(sockaddr). 所以现在你知道了什么错误消息意味着,开始使用调试器在运行时查看代码,找出哪个指针给出了问题,以及它指向的是什么。 我们无法为您执行此操作:代码运行时我们无法访问您的系统!So now you know what the error message means, start using the debugger to look at you code while it runs, to find out which pointer is giving the problem, and what it is pointing at. We cannot do that for you: we do not have any access to your system while your code is running! 这篇关于为什么显示10014套接字错误?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!
09-15 22:24