From 0c2fbe6e8fd903f562fd092892990f8ebeadc0a7 Mon Sep 17 00:00:00 2001 From: Gregory Nutt Date: Wed, 28 Jan 2015 08:39:48 -0600 Subject: Unix domain: More fixes. With these changes, apps/examples/ustream works --- apps/examples/ustream/ustream_client.c | 3 ++- apps/examples/ustream/ustream_server.c | 12 +++--------- 2 files changed, 5 insertions(+), 10 deletions(-) (limited to 'apps') diff --git a/apps/examples/ustream/ustream_client.c b/apps/examples/ustream/ustream_client.c index 797a5a18c..b09e9558b 100644 --- a/apps/examples/ustream/ustream_client.c +++ b/apps/examples/ustream/ustream_client.c @@ -103,7 +103,7 @@ int client_main(int argc, char *argv[]) strncpy(myaddr.sun_path, CONFIG_EXAMPLES_USTREAM_ADDR, addrlen); myaddr.sun_path[addrlen] = '\0'; - printf("client: Connecting...\n"); + printf("client: Connecting to %s...\n", CONFIG_EXAMPLES_USTREAM_ADDR); addrlen += sizeof(sa_family_t) + 1; ret = connect( sockfd, (struct sockaddr *)&myaddr, addrlen); if (ret < 0) @@ -176,6 +176,7 @@ int client_main(int argc, char *argv[]) goto errout_with_socket; } + printf("client: Terminating\n"); close(sockfd); free(outbuf); free(inbuf); diff --git a/apps/examples/ustream/ustream_server.c b/apps/examples/ustream/ustream_server.c index 4432019a4..0bd8467f0 100644 --- a/apps/examples/ustream/ustream_server.c +++ b/apps/examples/ustream/ustream_server.c @@ -113,6 +113,8 @@ int server_main(int argc, char *argv[]) /* Listen for connections on the bound socket */ + printf("server: Accepting connections on %s ...\n", CONFIG_EXAMPLES_USTREAM_ADDR); + if (listen(listensd, 5) < 0) { printf("server: listen failure %d\n", errno); @@ -121,7 +123,6 @@ int server_main(int argc, char *argv[]) /* Accept only one connection */ - printf("server: Accepting connections on %s\n", CONFIG_EXAMPLES_USTREAM_ADDR); acceptsd = accept(listensd, (struct sockaddr*)&myaddr, &addrlen); if (acceptsd < 0) { @@ -187,14 +188,7 @@ int server_main(int argc, char *argv[]) } printf("server: Sent %d bytes\n", nbytessent); - - /* If this platform only does abortive disconnects, then wait a bit to get the - * client side a change to receive the data. - */ - - printf("server: Wait before closing\n"); - sleep(60); - + printf("server: Terminating\n"); close(listensd); close(acceptsd); free(buffer); -- cgit v1.2.3