Commit 2b402c5c authored by jan.koester's avatar jan.koester
Browse files

test

parent 75220bb6
Loading
Loading
Loading
Loading
+8 −0
Original line number Diff line number Diff line
@@ -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
+3 −0
Original line number Diff line number Diff line
@@ -969,4 +969,7 @@ namespace netplus {
		friend class EventWorker;
		friend class EventWorkerArgs;
	};

	bool isIPAddr(const std::string &host);

} // namespace netplus
+8 −0
Original line number Diff line number Diff line
@@ -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