Loading src/posix/socket.cpp +8 −0 Original line number Diff line number Diff line Loading @@ -128,5 +128,13 @@ void netplus::socket::copyAddrInfo(ULONG_PTR* dest, ULONG_PTR src, size_t){ _AddrLen = (socklen_t)s->ai_addrlen; } bool netplus::isIPAddr(const std::string &host) { if (host.empty()) return false; struct in_addr v4; if (inet_pton(AF_INET, host.c_str(), &v4) == 1) return true; struct in6_addr v6; if (inet_pton(AF_INET6, host.c_str(), &v6) == 1) return true; return false; } } // namespace netplus src/socket.h +3 −0 Original line number Diff line number Diff line Loading @@ -969,4 +969,7 @@ namespace netplus { friend class EventWorker; friend class EventWorkerArgs; }; bool isIPAddr(const std::string &host); } // namespace netplus src/windows/socket.cpp +8 −0 Original line number Diff line number Diff line Loading @@ -221,5 +221,13 @@ namespace netplus { } } bool netplus::isIPAddr(const std::string &host) { if (host.empty()) return false; struct in_addr v4; if (inet_pton(AF_INET, host.c_str(), &v4) == 1) return true; struct in6_addr v6; if (inet_pton(AF_INET6, host.c_str(), &v6) == 1) return true; return false; } } // namespace netplus Loading
src/posix/socket.cpp +8 −0 Original line number Diff line number Diff line Loading @@ -128,5 +128,13 @@ void netplus::socket::copyAddrInfo(ULONG_PTR* dest, ULONG_PTR src, size_t){ _AddrLen = (socklen_t)s->ai_addrlen; } bool netplus::isIPAddr(const std::string &host) { if (host.empty()) return false; struct in_addr v4; if (inet_pton(AF_INET, host.c_str(), &v4) == 1) return true; struct in6_addr v6; if (inet_pton(AF_INET6, host.c_str(), &v6) == 1) return true; return false; } } // namespace netplus
src/socket.h +3 −0 Original line number Diff line number Diff line Loading @@ -969,4 +969,7 @@ namespace netplus { friend class EventWorker; friend class EventWorkerArgs; }; bool isIPAddr(const std::string &host); } // namespace netplus
src/windows/socket.cpp +8 −0 Original line number Diff line number Diff line Loading @@ -221,5 +221,13 @@ namespace netplus { } } bool netplus::isIPAddr(const std::string &host) { if (host.empty()) return false; struct in_addr v4; if (inet_pton(AF_INET, host.c_str(), &v4) == 1) return true; struct in6_addr v6; if (inet_pton(AF_INET6, host.c_str(), &v6) == 1) return true; return false; } } // namespace netplus