diff --git a/examples/linux/platform.h b/examples/linux/platform.h index 49b36c8..6b5e71d 100644 --- a/examples/linux/platform.h +++ b/examples/linux/platform.h @@ -106,6 +106,10 @@ int create_tcp_server(const char* address, const char* port) { freeaddrinfo(results); + if (fd < 0) { + return errno; + } + signal(SIGINT, close_server_on_exit); signal(SIGTERM, close_server_on_exit); signal(SIGQUIT, close_server_on_exit); diff --git a/examples/linux/server-tcp.c b/examples/linux/server-tcp.c index 1213f01..c26f2aa 100644 --- a/examples/linux/server-tcp.c +++ b/examples/linux/server-tcp.c @@ -95,7 +95,7 @@ int main(int argc, char* argv[]) { // Set up the TCP server int ret = create_tcp_server(argv[1], argv[2]); if (ret != 0) { - fprintf(stderr, "Error creating TCP server\n"); + fprintf(stderr, "Error creating TCP server - %s\n", strerror(ret)); return 1; }