Loading src/event/iocp.cpp +6 −9 Original line number Diff line number Diff line Loading @@ -61,12 +61,9 @@ namespace netplus { api = eapi; api->CreateConnetion(&CurCon); OpCode = 0; CurCon->csock->_Overlapped=new WSAOVERLAPPED; memset((void*)CurCon->csock->_Overlapped, 0, sizeof(WSAOVERLAPPED)); }; ~client() { delete CurCon->csock->_Overlapped; api->deleteConnetion(CurCon); }; Loading Loading @@ -159,7 +156,7 @@ namespace netplus { wbuf.len = BLOCKSIZE; int nBytesRecv = WSARecv(pClientContext->CurCon->csock->fd(), &wbuf, 1, &dwBytes, &dwFlags,pClientContext->CurCon->csock->_Overlapped, nullptr); &dwBytes, &dwFlags,&pClientContext->CurCon->csock->_Overlapped, nullptr); if (SOCKET_ERROR == nBytesRecv) { if (WSA_IO_PENDING != WSAGetLastError()) { Loading Loading @@ -321,7 +318,7 @@ namespace netplus { //Overlapped send ret = WSASend(pClientContext->CurCon->csock->fd(), &wbuf, 1, &dwBytes, dwFlags, pClientContext->CurCon->csock->_Overlapped, nullptr); &dwBytes, dwFlags, &pClientContext->CurCon->csock->_Overlapped, nullptr); if ((SOCKET_ERROR == ret) && (WSA_IO_PENDING != WSAGetLastError())) { //Let's not work with this client Loading Loading @@ -349,7 +346,7 @@ namespace netplus { //Get the data. ret = WSARecv(pClientContext->CurCon->csock->fd(), &wbuf, 1, &dwBytes, &dwFlags, pClientContext->CurCon->csock->_Overlapped, nullptr); &dwBytes, &dwFlags, &pClientContext->CurCon->csock->_Overlapped, nullptr); if ((SOCKET_ERROR == ret)) { std::cerr << "Thread " << tid << " : Error occurred while executing WSARecv()." << std::endl; Loading Loading @@ -387,7 +384,7 @@ namespace netplus { //Overlapped send ret = WSASend(pClientContext->CurCon->csock->fd(), &wbuf, 1, &dwBytes, dwFlags, pClientContext->CurCon->csock->_Overlapped, NULL); &dwBytes, dwFlags, &pClientContext->CurCon->csock->_Overlapped, NULL); TEST2: if (ret == SOCKET_ERROR) { std::cerr << "Thread " << tid << " <<: Error occurred while executing WSASend()." << std::endl; Loading Loading @@ -426,7 +423,7 @@ TEST2: //Get the data. TEST3: ret = WSARecv(pClientContext->CurCon->csock->fd(), &wbuf, 1, &dwBytes, &dwFlags, pClientContext->CurCon->csock->_Overlapped, nullptr); &dwBytes, &dwFlags, &pClientContext->CurCon->csock->_Overlapped, nullptr); if ((SOCKET_ERROR == ret)) { if (WSA_IO_PENDING != WSAGetLastError()) { Loading src/socket.h +1 −1 Original line number Diff line number Diff line Loading @@ -75,7 +75,7 @@ namespace netplus { ULONG_PTR _Extension; static std::atomic<int> _InitCount; #ifdef Windows WSAOVERLAPPED *_Overlapped; WSAOVERLAPPED _Overlapped; #endif protected: void copyAddrInfo(ULONG_PTR *dest,ULONG_PTR src); Loading src/windows/socket.cpp +1 −1 Original line number Diff line number Diff line Loading @@ -53,7 +53,7 @@ netplus::socket::socket(){ _Extension = 0; _Type=-1; _Socket = -1; _Overlapped = nullptr; memset(&_Overlapped, 0, sizeof(WSAOVERLAPPED)); if (_InitCount<1) { if (WSAStartup(MAKEWORD(2, 2), &_WSAData) != 0) { NetException exception; Loading src/windows/tcp.cpp +2 −2 Original line number Diff line number Diff line Loading @@ -170,7 +170,7 @@ size_t netplus::tcp::sendData(void* data, unsigned long size,int flags){ DWORD dwBytes = 0; DWORD dwFlags = 0; SOCKET rval=::WSASend(_Socket,&buf,1,&dwBytes,flags,_Overlapped,nullptr); SOCKET rval=::WSASend(_Socket,&buf,1,&dwBytes,flags,&_Overlapped,nullptr); if(rval == SOCKET_ERROR){ int etype=NetException::Error; Loading Loading @@ -201,7 +201,7 @@ size_t netplus::tcp::recvData(void* data, unsigned long size,int flags){ DWORD dwBytes = 0; DWORD dwFlags = 0; int recvsize=::WSARecv(_Socket, &buf, 1, &dwBytes,(LPDWORD) &flags, _Overlapped, nullptr); int recvsize=::WSARecv(_Socket, &buf, 1, &dwBytes,(LPDWORD) &flags, &_Overlapped, nullptr); if(recvsize<0){ int etype=NetException::Error; Loading src/windows/udp.cpp +2 −2 Original line number Diff line number Diff line Loading @@ -169,7 +169,7 @@ size_t netplus::udp::sendData(void* data, unsigned long size, int flags) { DWORD dwBytes = 0; DWORD dwFlags = 0; SOCKET rval = ::WSASend(_Socket, &buf, 1, &dwBytes, flags, _Overlapped, nullptr); SOCKET rval = ::WSASend(_Socket, &buf, 1, &dwBytes, flags, &_Overlapped, nullptr); if (rval == SOCKET_ERROR) { int etype = NetException::Error; Loading Loading @@ -200,7 +200,7 @@ size_t netplus::udp::recvData(void* data, unsigned long size, int flags) { DWORD dwBytes = 0; DWORD dwFlags = 0; int recvsize = ::WSARecv(_Socket, &buf, 1, &dwBytes, (LPDWORD)&flags, _Overlapped, nullptr); int recvsize = ::WSARecv(_Socket, &buf, 1, &dwBytes, (LPDWORD)&flags, &_Overlapped, nullptr); if (recvsize < 0) { int etype = NetException::Error; Loading Loading
src/event/iocp.cpp +6 −9 Original line number Diff line number Diff line Loading @@ -61,12 +61,9 @@ namespace netplus { api = eapi; api->CreateConnetion(&CurCon); OpCode = 0; CurCon->csock->_Overlapped=new WSAOVERLAPPED; memset((void*)CurCon->csock->_Overlapped, 0, sizeof(WSAOVERLAPPED)); }; ~client() { delete CurCon->csock->_Overlapped; api->deleteConnetion(CurCon); }; Loading Loading @@ -159,7 +156,7 @@ namespace netplus { wbuf.len = BLOCKSIZE; int nBytesRecv = WSARecv(pClientContext->CurCon->csock->fd(), &wbuf, 1, &dwBytes, &dwFlags,pClientContext->CurCon->csock->_Overlapped, nullptr); &dwBytes, &dwFlags,&pClientContext->CurCon->csock->_Overlapped, nullptr); if (SOCKET_ERROR == nBytesRecv) { if (WSA_IO_PENDING != WSAGetLastError()) { Loading Loading @@ -321,7 +318,7 @@ namespace netplus { //Overlapped send ret = WSASend(pClientContext->CurCon->csock->fd(), &wbuf, 1, &dwBytes, dwFlags, pClientContext->CurCon->csock->_Overlapped, nullptr); &dwBytes, dwFlags, &pClientContext->CurCon->csock->_Overlapped, nullptr); if ((SOCKET_ERROR == ret) && (WSA_IO_PENDING != WSAGetLastError())) { //Let's not work with this client Loading Loading @@ -349,7 +346,7 @@ namespace netplus { //Get the data. ret = WSARecv(pClientContext->CurCon->csock->fd(), &wbuf, 1, &dwBytes, &dwFlags, pClientContext->CurCon->csock->_Overlapped, nullptr); &dwBytes, &dwFlags, &pClientContext->CurCon->csock->_Overlapped, nullptr); if ((SOCKET_ERROR == ret)) { std::cerr << "Thread " << tid << " : Error occurred while executing WSARecv()." << std::endl; Loading Loading @@ -387,7 +384,7 @@ namespace netplus { //Overlapped send ret = WSASend(pClientContext->CurCon->csock->fd(), &wbuf, 1, &dwBytes, dwFlags, pClientContext->CurCon->csock->_Overlapped, NULL); &dwBytes, dwFlags, &pClientContext->CurCon->csock->_Overlapped, NULL); TEST2: if (ret == SOCKET_ERROR) { std::cerr << "Thread " << tid << " <<: Error occurred while executing WSASend()." << std::endl; Loading Loading @@ -426,7 +423,7 @@ TEST2: //Get the data. TEST3: ret = WSARecv(pClientContext->CurCon->csock->fd(), &wbuf, 1, &dwBytes, &dwFlags, pClientContext->CurCon->csock->_Overlapped, nullptr); &dwBytes, &dwFlags, &pClientContext->CurCon->csock->_Overlapped, nullptr); if ((SOCKET_ERROR == ret)) { if (WSA_IO_PENDING != WSAGetLastError()) { Loading
src/socket.h +1 −1 Original line number Diff line number Diff line Loading @@ -75,7 +75,7 @@ namespace netplus { ULONG_PTR _Extension; static std::atomic<int> _InitCount; #ifdef Windows WSAOVERLAPPED *_Overlapped; WSAOVERLAPPED _Overlapped; #endif protected: void copyAddrInfo(ULONG_PTR *dest,ULONG_PTR src); Loading
src/windows/socket.cpp +1 −1 Original line number Diff line number Diff line Loading @@ -53,7 +53,7 @@ netplus::socket::socket(){ _Extension = 0; _Type=-1; _Socket = -1; _Overlapped = nullptr; memset(&_Overlapped, 0, sizeof(WSAOVERLAPPED)); if (_InitCount<1) { if (WSAStartup(MAKEWORD(2, 2), &_WSAData) != 0) { NetException exception; Loading
src/windows/tcp.cpp +2 −2 Original line number Diff line number Diff line Loading @@ -170,7 +170,7 @@ size_t netplus::tcp::sendData(void* data, unsigned long size,int flags){ DWORD dwBytes = 0; DWORD dwFlags = 0; SOCKET rval=::WSASend(_Socket,&buf,1,&dwBytes,flags,_Overlapped,nullptr); SOCKET rval=::WSASend(_Socket,&buf,1,&dwBytes,flags,&_Overlapped,nullptr); if(rval == SOCKET_ERROR){ int etype=NetException::Error; Loading Loading @@ -201,7 +201,7 @@ size_t netplus::tcp::recvData(void* data, unsigned long size,int flags){ DWORD dwBytes = 0; DWORD dwFlags = 0; int recvsize=::WSARecv(_Socket, &buf, 1, &dwBytes,(LPDWORD) &flags, _Overlapped, nullptr); int recvsize=::WSARecv(_Socket, &buf, 1, &dwBytes,(LPDWORD) &flags, &_Overlapped, nullptr); if(recvsize<0){ int etype=NetException::Error; Loading
src/windows/udp.cpp +2 −2 Original line number Diff line number Diff line Loading @@ -169,7 +169,7 @@ size_t netplus::udp::sendData(void* data, unsigned long size, int flags) { DWORD dwBytes = 0; DWORD dwFlags = 0; SOCKET rval = ::WSASend(_Socket, &buf, 1, &dwBytes, flags, _Overlapped, nullptr); SOCKET rval = ::WSASend(_Socket, &buf, 1, &dwBytes, flags, &_Overlapped, nullptr); if (rval == SOCKET_ERROR) { int etype = NetException::Error; Loading Loading @@ -200,7 +200,7 @@ size_t netplus::udp::recvData(void* data, unsigned long size, int flags) { DWORD dwBytes = 0; DWORD dwFlags = 0; int recvsize = ::WSARecv(_Socket, &buf, 1, &dwBytes, (LPDWORD)&flags, _Overlapped, nullptr); int recvsize = ::WSARecv(_Socket, &buf, 1, &dwBytes, (LPDWORD)&flags, &_Overlapped, nullptr); if (recvsize < 0) { int etype = NetException::Error; Loading