diff options
Diffstat (limited to 'src/net')
| -rw-r--r-- | src/net/client.c | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/src/net/client.c b/src/net/client.c index 0d1686c..409de6a 100644 --- a/src/net/client.c +++ b/src/net/client.c @@ -15,7 +15,7 @@ * Client side function; connects to specified host:port * @param[in] host Hostname of server * @param[in] port Port of server - * @return Socket with open connection to server + * @return Socket with open connection to server or -1 on error */ int client_connect_server(const char* host, const char* port) { @@ -51,13 +51,10 @@ int client_connect_server(const char* host, const char* port) close(sock); } + freeaddrinfo(result); if(tmp == NULL) - { - printf("failed to connect\n"); - exit(EXIT_FAILURE); - } - freeaddrinfo(result); + return -1; return sock; } |
