diff --git a/source/net.cpp b/source/net.cpp index 35e1730..2aef392 100644 --- a/source/net.cpp +++ b/source/net.cpp @@ -25,15 +25,20 @@ void Socket::connect_server(const char *ip, uint16_t port) { void Socket::connect_unix(const char *ip, uint16_t port) { sock = socket(AF_UNIX, SOCK_STREAM, 0); if (sock < 0) { + perror("socket() Failed"); throw std::runtime_error("Failed to create UNIX socket"); } this->server_addr_unix.sun_family = AF_UNIX; strncpy(this->server_addr_unix.sun_path, ip, sizeof(this->server_addr_unix.sun_path) - 1); + printf("Connecting to UNIX socket at %s\n", ip); + if (connect(sock, (struct sockaddr *)&server_addr_unix, sizeof(server_addr_unix)) < 0) { throw std::runtime_error("Failed to connect to UNIX socket"); } + + printf("Connected to UNIX socket at %s\n", ip); } void Socket::send_server() {