From fadbb925a6a118790d8d661fea3956bb0f76348a Mon Sep 17 00:00:00 2001 From: patacongo Date: Sat, 18 Feb 2012 18:13:30 +0000 Subject: Correct and error in recv() and recvfrom() return value git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@4402 42af7a65-404d-4744-a932-0658087f49c3 --- apps/examples/poll/host.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'apps/examples/poll/host.c') diff --git a/apps/examples/poll/host.c b/apps/examples/poll/host.c index 47f2c3e53..302cceb0f 100644 --- a/apps/examples/poll/host.c +++ b/apps/examples/poll/host.c @@ -1,8 +1,8 @@ /**************************************************************************** * examples/poll/host.c * - * Copyright (C) 2008-2009 Gregory Nutt. All rights reserved. - * Author: Gregory Nutt + * Copyright (C) 2008-2009, 2012 Gregory Nutt. All rights reserved. + * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -137,6 +137,11 @@ int main(int argc, char **argv, char **envp) message("client: recv failed: %d\n", errno); goto errout_with_socket; } + else if (nbytesrecvd == 0) + { + message("client: The server broke the connections\n"); + goto errout_with_socket; + } inbuf[nbytesrecvd] = '\0'; message("client: Received '%s' (%d bytes)\n", inbuf, nbytesrecvd); -- cgit v1.2.3