Loading src/event/iocp.cpp +2 −5 Changes for src/event/iocp.cpp: 2 added lines, 5 removed lines. Original line number Diff line number Diff line Loading @@ -136,12 +136,9 @@ namespace netplus { g_eventapi->ConnectEvent(pClientContext->CurCon, tid, args); try { std::shared_ptr<char[]> buf(new char[BLOCKSIZE], std::default_delete<char[]>()); size_t recv = pClientContext->CurCon->csock->recvData(buf.get(), BLOCKSIZE, 0); size_t recv = pClientContext->CurCon->csock->recvData(nullptr, 0, 0); pClientContext->CurCon->RecvData.append(buf.get(), recv); g_eventapi->RequestEvent(pClientContext->CurCon, tid, args); WSAResetEvent(pClientContext->CurCon->csock->_Overlapped.hEvent); } catch (NetException& e) { std::cerr << e.what() << std::endl; Loading src/posix/udp.cpp +18 −14 Changes for src/posix/udp.cpp: 18 added lines, 14 removed lines. Original line number Diff line number Diff line Loading @@ -210,26 +210,30 @@ size_t netplus::udp::sendData(void* data, unsigned long size,int flags){ size_t netplus::udp::recvData(void* data, unsigned long size,int flags){ NetException exception; int recvsize=::recv(_Socket, data, size, flags ); if(recvsize<0){ int etype=NetException::Error; WSABUF buf; if(errno==EAGAIN || errno==EWOULDBLOCK) etype=NetException::Note; buf.buf = reinterpret_cast<char*>(data); buf.len = size; DWORD dwFlags = 0; DWORD dwBytes = 0; char errstr[512]; strerror_r_netplus(errno,errstr,512); int recvsize = ::WSARecv(_Socket, &buf, 1, &dwBytes, (LPDWORD)&flags, &_Overlapped, nullptr); exception[etype] << "Socket recvdata failed on Socket: " << _Socket << " ErrorMsg: " << errstr; if (recvsize == SOCKET_ERROR) { DWORD lerror = WSAGetLastError(); if (lerror != WSA_IO_PENDING) { exception[NetException::Error] << "Socket recvdata failed on Socket: " << (int)_Socket << " ErrorMsg: " << lerror; throw exception; } return (size_t)recvsize == 0 ? size : recvsize; else { return buf.len; } } return (size_t)buf.len; } void netplus::udp::connect(socket *ssock){ Loading src/windows/tcp.cpp +4 −4 Changes for src/windows/tcp.cpp: 4 added lines, 4 removed lines. Original line number Diff line number Diff line Loading @@ -220,9 +220,9 @@ size_t netplus::tcp::sendData(void* data, unsigned long size,int flags){ size_t netplus::tcp::recvData(void* data, unsigned long size,int flags){ NetException exception; WSABUF buf{0}; WSABUF buf; buf.buf = (char*)data; buf.buf = reinterpret_cast<char*>(data); buf.len = size; DWORD dwFlags = 0; Loading @@ -238,11 +238,11 @@ size_t netplus::tcp::recvData(void* data, unsigned long size,int flags){ << " ErrorMsg: " << lerror; throw exception; } else { return 0; return buf.len; } } return (size_t) recvsize; return (size_t) buf.len; } void netplus::tcp::connect(socket *ssock){ Loading Loading
src/event/iocp.cpp +2 −5 Changes for src/event/iocp.cpp: 2 added lines, 5 removed lines. Original line number Diff line number Diff line Loading @@ -136,12 +136,9 @@ namespace netplus { g_eventapi->ConnectEvent(pClientContext->CurCon, tid, args); try { std::shared_ptr<char[]> buf(new char[BLOCKSIZE], std::default_delete<char[]>()); size_t recv = pClientContext->CurCon->csock->recvData(buf.get(), BLOCKSIZE, 0); size_t recv = pClientContext->CurCon->csock->recvData(nullptr, 0, 0); pClientContext->CurCon->RecvData.append(buf.get(), recv); g_eventapi->RequestEvent(pClientContext->CurCon, tid, args); WSAResetEvent(pClientContext->CurCon->csock->_Overlapped.hEvent); } catch (NetException& e) { std::cerr << e.what() << std::endl; Loading
src/posix/udp.cpp +18 −14 Changes for src/posix/udp.cpp: 18 added lines, 14 removed lines. Original line number Diff line number Diff line Loading @@ -210,26 +210,30 @@ size_t netplus::udp::sendData(void* data, unsigned long size,int flags){ size_t netplus::udp::recvData(void* data, unsigned long size,int flags){ NetException exception; int recvsize=::recv(_Socket, data, size, flags ); if(recvsize<0){ int etype=NetException::Error; WSABUF buf; if(errno==EAGAIN || errno==EWOULDBLOCK) etype=NetException::Note; buf.buf = reinterpret_cast<char*>(data); buf.len = size; DWORD dwFlags = 0; DWORD dwBytes = 0; char errstr[512]; strerror_r_netplus(errno,errstr,512); int recvsize = ::WSARecv(_Socket, &buf, 1, &dwBytes, (LPDWORD)&flags, &_Overlapped, nullptr); exception[etype] << "Socket recvdata failed on Socket: " << _Socket << " ErrorMsg: " << errstr; if (recvsize == SOCKET_ERROR) { DWORD lerror = WSAGetLastError(); if (lerror != WSA_IO_PENDING) { exception[NetException::Error] << "Socket recvdata failed on Socket: " << (int)_Socket << " ErrorMsg: " << lerror; throw exception; } return (size_t)recvsize == 0 ? size : recvsize; else { return buf.len; } } return (size_t)buf.len; } void netplus::udp::connect(socket *ssock){ Loading
src/windows/tcp.cpp +4 −4 Changes for src/windows/tcp.cpp: 4 added lines, 4 removed lines. Original line number Diff line number Diff line Loading @@ -220,9 +220,9 @@ size_t netplus::tcp::sendData(void* data, unsigned long size,int flags){ size_t netplus::tcp::recvData(void* data, unsigned long size,int flags){ NetException exception; WSABUF buf{0}; WSABUF buf; buf.buf = (char*)data; buf.buf = reinterpret_cast<char*>(data); buf.len = size; DWORD dwFlags = 0; Loading @@ -238,11 +238,11 @@ size_t netplus::tcp::recvData(void* data, unsigned long size,int flags){ << " ErrorMsg: " << lerror; throw exception; } else { return 0; return buf.len; } } return (size_t) recvsize; return (size_t) buf.len; } void netplus::tcp::connect(socket *ssock){ Loading