MCPcopy Create free account
hub / github.com/PiSCSI/piscsi / ResolveHostName

Method ResolveHostName

cpp/shared/network_util.cpp:62–75  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

60}
61
62bool network_util::ResolveHostName(const string& host, sockaddr_in *addr)
63{
64 addrinfo hints = {};
65 hints.ai_family = AF_INET;
66 hints.ai_socktype = SOCK_STREAM;
67
68 if (addrinfo *result; !getaddrinfo(host.c_str(), nullptr, &hints, &result)) {
69 *addr = *reinterpret_cast<sockaddr_in *>(result->ai_addr); //NOSONAR bit_cast is not supported by the bullseye compiler
70 freeaddrinfo(result);
71 return true;
72 }
73
74 return false;
75}

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected