summaryrefslogtreecommitdiff
path: root/nuttx/examples/poll/host.c
diff options
context:
space:
mode:
Diffstat (limited to 'nuttx/examples/poll/host.c')
-rw-r--r--nuttx/examples/poll/host.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/nuttx/examples/poll/host.c b/nuttx/examples/poll/host.c
index 722d351d8..a55c1843e 100644
--- a/nuttx/examples/poll/host.c
+++ b/nuttx/examples/poll/host.c
@@ -99,7 +99,7 @@ int main(int argc, char **argv, char **envp)
myaddr.sin_family = AF_INET;
myaddr.sin_port = htons(LISTENER_PORT);
- myaddr.sin_addr.s_addr = htonl(inet_addr(TARGETIP));
+ myaddr.sin_addr.s_addr = inet_addr(TARGETIP);
message("client: Connecting to %s...\n", TARGETIP);
if (connect( sockfd, (struct sockaddr*)&myaddr, sizeof(struct sockaddr_in)) < 0)
@@ -111,7 +111,7 @@ int main(int argc, char **argv, char **envp)
/* Then send and receive messages */
- for (i = 0; ; i++);
+ for (i = 0; ; i++)
{
sprintf(outbuf, "Remote message %d", i);
len = strlen(outbuf);
@@ -139,6 +139,8 @@ int main(int argc, char **argv, char **envp)
message("client: recv failed: %d\n", errno);
goto errout_with_socket;
}
+
+ inbuf[nbytesrecvd] = '\0';
message("client: Received '%s' (%d bytes)\n", inbuf, nbytesrecvd);
if (nbytesrecvd != len)