Loading src/windows/tcp.cpp +6 −6 Changes for src/windows/tcp.cpp: 6 added lines, 6 removed lines. Original line number Diff line number Diff line Loading @@ -67,18 +67,18 @@ netplus::tcp::tcp(const std::string& addr, int port, int maxconnections, int soc hints.ai_addr = NULL; hints.ai_next = NULL; int tsock; char serv[512] = {'\0'}; snprintf(serv,512,"%d",port); if ((tsock=::getaddrinfo(addr.c_str(), serv,&hints,&result)) != 0 ) { if (::getaddrinfo(addr.c_str(), serv,&hints,&result) != 0 ) { exception[NetException::Critical] << "Socket Invalid address/ Address not supported"; throw exception; } std::cerr << result << std::endl; for (rp = result; rp != nullptr; rp = rp->ai_next) { _Socket = ::WSASocketW(rp->ai_family, rp->ai_socktype, _Socket = ::WSASocket(rp->ai_family, rp->ai_socktype, rp->ai_protocol,nullptr, 0, sockopts); if (_Socket == INVALID_SOCKET) Loading Loading @@ -175,7 +175,7 @@ void netplus::tcp::accept(LPFN_ACCEPTEX lpfnAcceptEx,std::unique_ptr<socket> &cs ((struct sockaddr_in*)((struct addrinfo*)csock->_SocketInfo)->ai_addr)->sin_port = ((struct sockaddr_in*)((struct addrinfo*)_SocketInfo)->ai_addr)->sin_port; if ((csock->_Socket = WSASocketW(((struct addrinfo*)_SocketInfo)->ai_family, if ((csock->_Socket = WSASocket(((struct addrinfo*)_SocketInfo)->ai_family, ((struct addrinfo*)_SocketInfo)->ai_socktype, 0, nullptr, 0, WSA_FLAG_OVERLAPPED)) < 0) { exception[NetException::Error] << "Accept create Socket faied: failed on " << (int)csock->_Socket << " error code : " << GetLastError(); throw exception; Loading Loading @@ -319,7 +319,7 @@ void netplus::tcp::connect(std::unique_ptr<socket> &csock){ copyAddrInfo(&_SocketInfo, csock->_SocketInfo, csock->_SocketInfoLen); // Change this line to create an overlapped socket if ((_Socket = ::WSASocketW(((struct addrinfo*)_SocketInfo)->ai_family, ((struct addrinfo*)_SocketInfo)->ai_socktype, if ((_Socket = ::WSASocket(((struct addrinfo*)_SocketInfo)->ai_family, ((struct addrinfo*)_SocketInfo)->ai_socktype, ((struct addrinfo*)_SocketInfo)->ai_protocol, nullptr, 0, WSA_FLAG_OVERLAPPED)) < 0) { NetException exception; exception[NetException::Error] << "Create Socket " << (int)_Socket << " failed : " << GetLastError(); Loading src/windows/udp.cpp +4 −4 Changes for src/windows/udp.cpp: 4 added lines, 4 removed lines. Original line number Diff line number Diff line Loading @@ -57,7 +57,7 @@ netplus::udp::udp(const std::string &addr, int port, int maxconnections, int soc struct addrinfo hints, * result = nullptr, * rp = nullptr; memset(&hints, 0, sizeof(hints)); hints.ai_family = AF_UNSPEC; hints.ai_family = AF_INET; hints.ai_socktype = SOCK_DGRAM; hints.ai_flags = AI_PASSIVE; hints.ai_protocol = IPPROTO_UDP; Loading @@ -76,7 +76,7 @@ netplus::udp::udp(const std::string &addr, int port, int maxconnections, int soc } for (rp = result; rp != nullptr; rp = rp->ai_next) { _Socket = ::WSASocketW(rp->ai_family, rp->ai_socktype, _Socket = ::WSASocket(rp->ai_family, rp->ai_socktype, rp->ai_protocol, nullptr, 0, sockopts); if (_Socket == -1) continue; Loading Loading @@ -162,7 +162,7 @@ void netplus::udp::accept(LPFN_ACCEPTEX lpfnAcceptEx, std::unique_ptr<socket> &c ((struct sockaddr_in*)((struct addrinfo*)csock->_SocketInfo)->ai_addr)->sin_port = ((struct sockaddr_in*)((struct addrinfo*)_SocketInfo)->ai_addr)->sin_port; if ((csock->_Socket = WSASocketW(((struct addrinfo*)_SocketInfo)->ai_family, if ((csock->_Socket = WSASocket(((struct addrinfo*)_SocketInfo)->ai_family, ((struct addrinfo*)_SocketInfo)->ai_socktype, 0, nullptr, 0, WSA_FLAG_OVERLAPPED)) < 0) { exception[NetException::Error] << "Accept create Socket faied: failed on " << (int)csock->_Socket << " error code : " << GetLastError(); throw exception; Loading Loading @@ -304,7 +304,7 @@ void netplus::udp::connect(std::unique_ptr<socket> &csock) { copyAddrInfo(&_SocketInfo, csock->_SocketInfo, csock->_SocketInfoLen); // Change this line to create an overlapped socket if ((_Socket = ::WSASocketW(((struct addrinfo*)_SocketInfo)->ai_family, ((struct addrinfo*)_SocketInfo)->ai_socktype, if ((_Socket = ::WSASocket(((struct addrinfo*)_SocketInfo)->ai_family, ((struct addrinfo*)_SocketInfo)->ai_socktype, ((struct addrinfo*)_SocketInfo)->ai_protocol, nullptr, 0, WSA_FLAG_OVERLAPPED)) < 0) { NetException exception; exception[NetException::Error] << "Create Socket " << (int)_Socket << " failed : " << GetLastError(); Loading Loading
src/windows/tcp.cpp +6 −6 Changes for src/windows/tcp.cpp: 6 added lines, 6 removed lines. Original line number Diff line number Diff line Loading @@ -67,18 +67,18 @@ netplus::tcp::tcp(const std::string& addr, int port, int maxconnections, int soc hints.ai_addr = NULL; hints.ai_next = NULL; int tsock; char serv[512] = {'\0'}; snprintf(serv,512,"%d",port); if ((tsock=::getaddrinfo(addr.c_str(), serv,&hints,&result)) != 0 ) { if (::getaddrinfo(addr.c_str(), serv,&hints,&result) != 0 ) { exception[NetException::Critical] << "Socket Invalid address/ Address not supported"; throw exception; } std::cerr << result << std::endl; for (rp = result; rp != nullptr; rp = rp->ai_next) { _Socket = ::WSASocketW(rp->ai_family, rp->ai_socktype, _Socket = ::WSASocket(rp->ai_family, rp->ai_socktype, rp->ai_protocol,nullptr, 0, sockopts); if (_Socket == INVALID_SOCKET) Loading Loading @@ -175,7 +175,7 @@ void netplus::tcp::accept(LPFN_ACCEPTEX lpfnAcceptEx,std::unique_ptr<socket> &cs ((struct sockaddr_in*)((struct addrinfo*)csock->_SocketInfo)->ai_addr)->sin_port = ((struct sockaddr_in*)((struct addrinfo*)_SocketInfo)->ai_addr)->sin_port; if ((csock->_Socket = WSASocketW(((struct addrinfo*)_SocketInfo)->ai_family, if ((csock->_Socket = WSASocket(((struct addrinfo*)_SocketInfo)->ai_family, ((struct addrinfo*)_SocketInfo)->ai_socktype, 0, nullptr, 0, WSA_FLAG_OVERLAPPED)) < 0) { exception[NetException::Error] << "Accept create Socket faied: failed on " << (int)csock->_Socket << " error code : " << GetLastError(); throw exception; Loading Loading @@ -319,7 +319,7 @@ void netplus::tcp::connect(std::unique_ptr<socket> &csock){ copyAddrInfo(&_SocketInfo, csock->_SocketInfo, csock->_SocketInfoLen); // Change this line to create an overlapped socket if ((_Socket = ::WSASocketW(((struct addrinfo*)_SocketInfo)->ai_family, ((struct addrinfo*)_SocketInfo)->ai_socktype, if ((_Socket = ::WSASocket(((struct addrinfo*)_SocketInfo)->ai_family, ((struct addrinfo*)_SocketInfo)->ai_socktype, ((struct addrinfo*)_SocketInfo)->ai_protocol, nullptr, 0, WSA_FLAG_OVERLAPPED)) < 0) { NetException exception; exception[NetException::Error] << "Create Socket " << (int)_Socket << " failed : " << GetLastError(); Loading
src/windows/udp.cpp +4 −4 Changes for src/windows/udp.cpp: 4 added lines, 4 removed lines. Original line number Diff line number Diff line Loading @@ -57,7 +57,7 @@ netplus::udp::udp(const std::string &addr, int port, int maxconnections, int soc struct addrinfo hints, * result = nullptr, * rp = nullptr; memset(&hints, 0, sizeof(hints)); hints.ai_family = AF_UNSPEC; hints.ai_family = AF_INET; hints.ai_socktype = SOCK_DGRAM; hints.ai_flags = AI_PASSIVE; hints.ai_protocol = IPPROTO_UDP; Loading @@ -76,7 +76,7 @@ netplus::udp::udp(const std::string &addr, int port, int maxconnections, int soc } for (rp = result; rp != nullptr; rp = rp->ai_next) { _Socket = ::WSASocketW(rp->ai_family, rp->ai_socktype, _Socket = ::WSASocket(rp->ai_family, rp->ai_socktype, rp->ai_protocol, nullptr, 0, sockopts); if (_Socket == -1) continue; Loading Loading @@ -162,7 +162,7 @@ void netplus::udp::accept(LPFN_ACCEPTEX lpfnAcceptEx, std::unique_ptr<socket> &c ((struct sockaddr_in*)((struct addrinfo*)csock->_SocketInfo)->ai_addr)->sin_port = ((struct sockaddr_in*)((struct addrinfo*)_SocketInfo)->ai_addr)->sin_port; if ((csock->_Socket = WSASocketW(((struct addrinfo*)_SocketInfo)->ai_family, if ((csock->_Socket = WSASocket(((struct addrinfo*)_SocketInfo)->ai_family, ((struct addrinfo*)_SocketInfo)->ai_socktype, 0, nullptr, 0, WSA_FLAG_OVERLAPPED)) < 0) { exception[NetException::Error] << "Accept create Socket faied: failed on " << (int)csock->_Socket << " error code : " << GetLastError(); throw exception; Loading Loading @@ -304,7 +304,7 @@ void netplus::udp::connect(std::unique_ptr<socket> &csock) { copyAddrInfo(&_SocketInfo, csock->_SocketInfo, csock->_SocketInfoLen); // Change this line to create an overlapped socket if ((_Socket = ::WSASocketW(((struct addrinfo*)_SocketInfo)->ai_family, ((struct addrinfo*)_SocketInfo)->ai_socktype, if ((_Socket = ::WSASocket(((struct addrinfo*)_SocketInfo)->ai_family, ((struct addrinfo*)_SocketInfo)->ai_socktype, ((struct addrinfo*)_SocketInfo)->ai_protocol, nullptr, 0, WSA_FLAG_OVERLAPPED)) < 0) { NetException exception; exception[NetException::Error] << "Create Socket " << (int)_Socket << " failed : " << GetLastError(); Loading