diff --git a/src/network/TCPSocket.cpp b/src/network/TCPSocket.cpp index 28c9050..c9e1c67 100644 --- a/src/network/TCPSocket.cpp +++ b/src/network/TCPSocket.cpp @@ -25,15 +25,19 @@ bool TCPSocket::Connect(const IPAddress& address, unsigned short port) { struct addrinfo hints = { 0 }, * result = nullptr; - if ((m_Handle = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP)) < 0) + if ((m_Handle = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP)) < 0) { + std::cerr << "Failed to create socket !\n"; return false; + } hints.ai_family = AF_INET; hints.ai_socktype = SOCK_STREAM; hints.ai_protocol = IPPROTO_TCP; - if (getaddrinfo(address.ToString().c_str(), std::to_string(port).c_str(), &hints, &result) != 0) + if (getaddrinfo(address.ToString().c_str(), std::to_string(port).c_str(), &hints, &result) != 0) { + std::cerr << "Failed to get adress info !\n"; return false; + } struct addrinfo* ptr = nullptr; for (ptr = result; ptr != nullptr; ptr = ptr->ai_next) { @@ -46,8 +50,10 @@ bool TCPSocket::Connect(const IPAddress& address, unsigned short port) { freeaddrinfo(result); - if (!ptr) + if (!ptr) { + std::cerr << "Could not find a suitable interface for connecting !\n"; return false; + } this->SetStatus(Connected); m_RemoteIP = address;