htonl in ipToString

This commit is contained in:
2025-11-14 19:25:52 +01:00
parent 3ad98b8403
commit 2343fdd1e2

View File

@@ -51,7 +51,7 @@ namespace ColumnLynx::Net {
static inline std::string ipToString(uint32_t ip) { static inline std::string ipToString(uint32_t ip) {
struct in_addr addr; struct in_addr addr;
addr.s_addr = ip; // expected in network byte order addr.s_addr = htonl(ip);
char buf[INET_ADDRSTRLEN]; char buf[INET_ADDRSTRLEN];
if (!inet_ntop(AF_INET, &addr, buf, sizeof(buf))) if (!inet_ntop(AF_INET, &addr, buf, sizeof(buf)))