Skip to content
This repository has been archived by the owner on Jun 8, 2023. It is now read-only.

Commit

Permalink
Fixed bug where the server did not work properly on windows
Browse files Browse the repository at this point in the history
  • Loading branch information
victorrjimenezz committed Feb 4, 2022
1 parent c24c515 commit b2beaab
Showing 1 changed file with 2 additions and 19 deletions.
21 changes: 2 additions & 19 deletions src/utils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,7 @@
#include "utils.h"
#include <string>

#ifdef _WIN32
#include <winsock2.h>
#include <ws2tcpip.h>
#include <iphlpapi.h>
#include <ws2def.h>
#pragma comment(lib, "Ws2_32.lib")
#include <windows.h>
#include <io.h>
#elif __APPLE__
#if __APPLE__
#include <cstdio>
#include <cstdlib>
#include <unistd.h>
Expand All @@ -24,16 +16,7 @@

#ifdef _WIN32
std::string getIP(){
WSADATA wsa_Data;
int wsa_ReturnCode = WSAStartup(0x101,&wsa_Data);
char szHostName[255];
gethostname(szHostName, 255);
struct hostent *host_entry;
host_entry=gethostbyname(szHostName);
char * szLocalIP;
szLocalIP = inet_ntoa (*(struct in_addr *)*host_entry->h_addr_list);
WSACleanup();
return {szLocalIP};
return "0.0.0.0";
}
#elif __APPLE__

Expand Down

0 comments on commit b2beaab

Please sign in to comment.