Skip to content

Commit

Permalink
Update
Browse files Browse the repository at this point in the history
  • Loading branch information
sunkafei committed Jul 18, 2023
1 parent 480c50d commit 3d8c572
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/server.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@
#include "database.h"
httplib::Server server;
void start_server() {
char buffer[1024];
std::string ip = "127.0.0.1";
#if defined(WIN32) || defined(_WIN32) || defined(__WIN32__)
std::string ip = "127.0.0.1";
char buffer[1024];
FILE *stream = _popen("ipconfig", "r");
while (fgets(buffer, std::ssize(buffer), stream)) {
std::string line(buffer);
Expand All @@ -26,6 +26,7 @@ void start_server() {
}
}
#else
std::string ip;
FILE *output = popen("dig +short myip.opendns.com @resolver1.opendns.com", "r");
for (;;) {
auto ch = fgetc(output);
Expand Down

0 comments on commit 3d8c572

Please sign in to comment.