Skip to content

Commit

Permalink
Different socket path for Linux and Windows
Browse files Browse the repository at this point in the history
  • Loading branch information
kirill-scherba committed Aug 20, 2023
1 parent 9dff571 commit 7fbb274
Showing 1 changed file with 11 additions and 7 deletions.
18 changes: 11 additions & 7 deletions cmd/trugw/client-cpp/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,21 +10,25 @@
#include "../../../trugw-c/trugw.hpp"
#include <iostream>

int main(int argc, char* argv[]) {
int main(int argc, char *argv[]) {

// Get unix socket path
#ifdef _WIN32
char *tmp_path = getenv("TEMP");
std::string socket_path = std::string(tmp_path) + "\\trugw.sock";
#else
std::string socket_path = std::string("/tmp/trugw.sock");
#endif

// Get tru peer address
std::string tru_addr = ":7070";
if (argc >= 2) {
tru_addr = std::string(argv[1]);
}
std::string tru_addr = ":7070";
if (argc >= 2) {
tru_addr = std::string(argv[1]);
}

std::cout << "Trugw C++ client, "
<< "sock path: " << socket_path
<< "tru peer: " << socket_path << std::endl;
<< "sock path: " << socket_path << "tru peer: " << socket_path
<< std::endl;

// Connect to teogw server
std::cout << "trying to connect...\n";
Expand Down

0 comments on commit 7fbb274

Please sign in to comment.