MCPcopy Create free account
hub / github.com/Tencent/Hardcoder / sockaddrToIpPort

Function sockaddrToIpPort

libapp2sys/src/main/cpp/util.h:152–159  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

150}
151
152static int sockaddrToIpPort(struct sockaddr_in addr, std::string *ip, int *pPort) {
153 char a[32] = {0};
154 unsigned char *bytes = (unsigned char *) &addr.sin_addr;
155 snprintf(a, sizeof(a), "%d.%d.%d.%d", bytes[0], bytes[1], bytes[2], bytes[3]);
156 *ip = a;
157 *pPort = ntohs(addr.sin_port);
158 return 0;
159}
160
161static int64_t sockaddrToint64(struct sockaddr_in addr) {
162 int64_t s = addr.sin_port;

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected