Loading src/socket.h +1 Changes for src/socket.h: 1 added line, 0 removed lines. Original line number Diff line number Diff line Loading @@ -116,6 +116,7 @@ namespace netplus { #ifdef Windows WSAOVERLAPPED _Overlapped; WSABUF _wsaBuf; bool _Wait; #endif protected: void copyAddrInfo(ULONG_PTR *dest,ULONG_PTR src,size_t srclen); Loading src/windows/socket.cpp +2 Changes for src/windows/socket.cpp: 2 added lines, 0 removed lines. Original line number Diff line number Diff line Loading @@ -47,12 +47,14 @@ std::atomic<int> netplus::socket::_InitCount=0; WSAData _WSAData; netplus::socket::socket(){ memset(&_Overlapped, 0, sizeof(_Overlapped)); _SocketInfo=(ULONG_PTR)malloc(sizeof(struct addrinfo)); _SocketInfoLen=sizeof(struct addrinfo); memset((void*)_SocketInfo,0,sizeof(struct addrinfo)); _Extension = 0; _Type=-1; _Socket = -1; _Wait = false; _wsaBuf.buf = nullptr; _wsaBuf.len = 0; memset(&_Overlapped, 0, sizeof(WSAOVERLAPPED)); Loading src/windows/tcp.cpp +9 −2 Changes for src/windows/tcp.cpp: 9 added lines, 2 removed lines. Original line number Diff line number Diff line Loading @@ -170,8 +170,6 @@ void netplus::tcp::accept(LPFN_ACCEPTEX lpfnAcceptEx,std::shared_ptr<socket> &cs throw exception; } memset(&csock->_Overlapped, 0, sizeof(csock->_Overlapped)); if (!lpfnAcceptEx(_Socket,csock->_Socket, &AcceptBuffer, 0, sizeof(SOCKADDR_IN6) + 16, sizeof(SOCKADDR_IN6) + 16, &dwbytes, &csock->_Overlapped)) { Loading Loading @@ -207,6 +205,9 @@ size_t netplus::tcp::sendData(buffer &data,int flags){ int rval = ::WSASend(_Socket, &_wsaBuf, 1, &dwsend, flags, &_Overlapped, nullptr); if (_Wait) WSAWaitForMultipleEvents(1, &_Overlapped.hEvent, FALSE, INFINITE, FALSE); NetException exception; if (rval == SOCKET_ERROR) { Loading Loading @@ -243,6 +244,9 @@ size_t netplus::tcp::recvData(buffer &data,int flags){ int rval = ::WSARecv(_Socket, &_wsaBuf, 1, &dwBytes, (LPDWORD)&flags, &_Overlapped, nullptr); if (_Wait) WSAWaitForMultipleEvents(1, &_Overlapped.hEvent, FALSE, INFINITE, FALSE); if (rval == SOCKET_ERROR) { switch (WSAGetLastError()) { case WSAEWOULDBLOCK: Loading Loading @@ -292,6 +296,9 @@ void netplus::tcp::connect(std::shared_ptr<socket> &csock){ exception[NetException::Error] << "Connect: getpeername failed on " << (int)_Socket << " error code : " << GetLastError(); throw exception; } _Wait = true; } Loading src/windows/udp.cpp +8 −2 Changes for src/windows/udp.cpp: 8 added lines, 2 removed lines. Original line number Diff line number Diff line Loading @@ -167,8 +167,6 @@ void netplus::udp::accept(LPFN_ACCEPTEX lpfnAcceptEx, std::shared_ptr<socket> &c throw exception; } memset(&csock->_Overlapped, 0, sizeof(csock->_Overlapped)); if (!lpfnAcceptEx(_Socket, csock->_Socket, &AcceptBuffer, 0, sizeof(SOCKADDR_IN6) + 16, sizeof(SOCKADDR_IN6) + 16, &dwbytes, &csock->_Overlapped)) { Loading Loading @@ -203,6 +201,9 @@ size_t netplus::udp::sendData(buffer &data, int flags) { int rval = ::WSASend(_Socket, &_wsaBuf, 1, &dwsend, flags, &_Overlapped, nullptr); if(_Wait) WSAWaitForMultipleEvents(1, &_Overlapped.hEvent, FALSE, INFINITE, FALSE); NetException exception; if (rval == SOCKET_ERROR) { Loading Loading @@ -239,6 +240,9 @@ size_t netplus::udp::recvData(buffer &data, int flags) { int rval = ::WSARecv(_Socket, &_wsaBuf, 1, &dwBytes, (LPDWORD)&flags, &_Overlapped, nullptr); if(_Wait) WSAWaitForMultipleEvents(1,&_Overlapped.hEvent, FALSE, INFINITE, FALSE); if (rval == SOCKET_ERROR) { switch (WSAGetLastError()) { case WSAEWOULDBLOCK: Loading Loading @@ -287,6 +291,8 @@ void netplus::udp::connect(std::shared_ptr<socket> &csock) { exception[NetException::Error] << "Connect: getpeername failed on " << (int)_Socket << " error code : " << GetLastError(); throw exception; } _Wait = true; } Loading Loading
src/socket.h +1 Changes for src/socket.h: 1 added line, 0 removed lines. Original line number Diff line number Diff line Loading @@ -116,6 +116,7 @@ namespace netplus { #ifdef Windows WSAOVERLAPPED _Overlapped; WSABUF _wsaBuf; bool _Wait; #endif protected: void copyAddrInfo(ULONG_PTR *dest,ULONG_PTR src,size_t srclen); Loading
src/windows/socket.cpp +2 Changes for src/windows/socket.cpp: 2 added lines, 0 removed lines. Original line number Diff line number Diff line Loading @@ -47,12 +47,14 @@ std::atomic<int> netplus::socket::_InitCount=0; WSAData _WSAData; netplus::socket::socket(){ memset(&_Overlapped, 0, sizeof(_Overlapped)); _SocketInfo=(ULONG_PTR)malloc(sizeof(struct addrinfo)); _SocketInfoLen=sizeof(struct addrinfo); memset((void*)_SocketInfo,0,sizeof(struct addrinfo)); _Extension = 0; _Type=-1; _Socket = -1; _Wait = false; _wsaBuf.buf = nullptr; _wsaBuf.len = 0; memset(&_Overlapped, 0, sizeof(WSAOVERLAPPED)); Loading
src/windows/tcp.cpp +9 −2 Changes for src/windows/tcp.cpp: 9 added lines, 2 removed lines. Original line number Diff line number Diff line Loading @@ -170,8 +170,6 @@ void netplus::tcp::accept(LPFN_ACCEPTEX lpfnAcceptEx,std::shared_ptr<socket> &cs throw exception; } memset(&csock->_Overlapped, 0, sizeof(csock->_Overlapped)); if (!lpfnAcceptEx(_Socket,csock->_Socket, &AcceptBuffer, 0, sizeof(SOCKADDR_IN6) + 16, sizeof(SOCKADDR_IN6) + 16, &dwbytes, &csock->_Overlapped)) { Loading Loading @@ -207,6 +205,9 @@ size_t netplus::tcp::sendData(buffer &data,int flags){ int rval = ::WSASend(_Socket, &_wsaBuf, 1, &dwsend, flags, &_Overlapped, nullptr); if (_Wait) WSAWaitForMultipleEvents(1, &_Overlapped.hEvent, FALSE, INFINITE, FALSE); NetException exception; if (rval == SOCKET_ERROR) { Loading Loading @@ -243,6 +244,9 @@ size_t netplus::tcp::recvData(buffer &data,int flags){ int rval = ::WSARecv(_Socket, &_wsaBuf, 1, &dwBytes, (LPDWORD)&flags, &_Overlapped, nullptr); if (_Wait) WSAWaitForMultipleEvents(1, &_Overlapped.hEvent, FALSE, INFINITE, FALSE); if (rval == SOCKET_ERROR) { switch (WSAGetLastError()) { case WSAEWOULDBLOCK: Loading Loading @@ -292,6 +296,9 @@ void netplus::tcp::connect(std::shared_ptr<socket> &csock){ exception[NetException::Error] << "Connect: getpeername failed on " << (int)_Socket << " error code : " << GetLastError(); throw exception; } _Wait = true; } Loading
src/windows/udp.cpp +8 −2 Changes for src/windows/udp.cpp: 8 added lines, 2 removed lines. Original line number Diff line number Diff line Loading @@ -167,8 +167,6 @@ void netplus::udp::accept(LPFN_ACCEPTEX lpfnAcceptEx, std::shared_ptr<socket> &c throw exception; } memset(&csock->_Overlapped, 0, sizeof(csock->_Overlapped)); if (!lpfnAcceptEx(_Socket, csock->_Socket, &AcceptBuffer, 0, sizeof(SOCKADDR_IN6) + 16, sizeof(SOCKADDR_IN6) + 16, &dwbytes, &csock->_Overlapped)) { Loading Loading @@ -203,6 +201,9 @@ size_t netplus::udp::sendData(buffer &data, int flags) { int rval = ::WSASend(_Socket, &_wsaBuf, 1, &dwsend, flags, &_Overlapped, nullptr); if(_Wait) WSAWaitForMultipleEvents(1, &_Overlapped.hEvent, FALSE, INFINITE, FALSE); NetException exception; if (rval == SOCKET_ERROR) { Loading Loading @@ -239,6 +240,9 @@ size_t netplus::udp::recvData(buffer &data, int flags) { int rval = ::WSARecv(_Socket, &_wsaBuf, 1, &dwBytes, (LPDWORD)&flags, &_Overlapped, nullptr); if(_Wait) WSAWaitForMultipleEvents(1,&_Overlapped.hEvent, FALSE, INFINITE, FALSE); if (rval == SOCKET_ERROR) { switch (WSAGetLastError()) { case WSAEWOULDBLOCK: Loading Loading @@ -287,6 +291,8 @@ void netplus::udp::connect(std::shared_ptr<socket> &csock) { exception[NetException::Error] << "Connect: getpeername failed on " << (int)_Socket << " error code : " << GetLastError(); throw exception; } _Wait = true; } Loading