Skip to content

Commit

Permalink
fix: win32 now uses INADDR_ANY
Browse files Browse the repository at this point in the history
  • Loading branch information
Jaskowicz1 committed Jan 2, 2024
1 parent 8e6fd6f commit 25494b0
Showing 1 changed file with 5 additions and 8 deletions.
13 changes: 5 additions & 8 deletions src/rconpp/server.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -108,15 +108,7 @@ bool rconpp::rcon_server::startup_server() {

// Setup port, address, and family.
server.sin_family = AF_INET;
#ifdef _WIN32
#ifdef UNICODE
InetPton(AF_INET, std::wstring(address.begin(), address.end()).c_str(), &server.sin_addr.s_addr);
#else
InetPton(AF_INET, address.c_str(), &server.sin_addr.s_addr);
#endif
#else
server.sin_addr.s_addr = INADDR_ANY;
#endif
server.sin_port = htons(serv_info.port);

int allow = 1;
Expand All @@ -141,7 +133,12 @@ bool rconpp::rcon_server::startup_server() {
}

void rconpp::rcon_server::disconnect_client(const int client_socket) {

#ifdef _WIN32
closesocket(client_socket);
#else
close(client_socket);
#endif

connected_clients.at(client_socket).connected = false;

Expand Down

0 comments on commit 25494b0

Please sign in to comment.