mirror of
https://github.com/open-goal/jak-project
synced 2026-08-13 20:25:20 -04:00
cleanup our cmake and build warnings (#2876)
This commit is contained in:
@@ -6,6 +6,7 @@
|
||||
// clang-format off
|
||||
#include "common/common_types.h"
|
||||
#ifdef OS_POSIX
|
||||
#include <arpa/inet.h>
|
||||
#include <netinet/tcp.h>
|
||||
#include <sys/socket.h>
|
||||
#include <unistd.h>
|
||||
@@ -178,3 +179,13 @@ bool socket_timed_out() {
|
||||
return err == WSAETIMEDOUT;
|
||||
#endif
|
||||
}
|
||||
|
||||
std::string address_to_string(const sockaddr_in& addr) {
|
||||
char ip_str[INET_ADDRSTRLEN]; // Buffer to hold the IP address string
|
||||
// Convert binary IP address to human-readable string using inet_ntop
|
||||
if (inet_ntop(AF_INET, &(addr.sin_addr), ip_str, INET_ADDRSTRLEN) == nullptr) {
|
||||
// Handle the error (e.g., log, throw an exception, etc.)
|
||||
return "Error: Unable to convert IP address";
|
||||
}
|
||||
return ip_str;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user