mirror of
https://github.com/apache/nuttx-apps.git
synced 2025-10-19 19:44:35 +08:00
netcat_server: do not loop forever
To make it similar to other implementations. (I followed the behavior of NetBSD's nc, which came from OpenBSD.)
This commit is contained in:

committed by
Xiang Xiao

parent
eb996e5650
commit
8a19fe36e1
@@ -133,13 +133,9 @@ int netcat_server(int argc, char * argv[])
|
|||||||
|
|
||||||
socklen_t addrlen;
|
socklen_t addrlen;
|
||||||
int conn;
|
int conn;
|
||||||
while ((conn = accept(id, (struct sockaddr *)&client, &addrlen)) != -1)
|
if ((conn = accept(id, (struct sockaddr *)&client, &addrlen)) != -1)
|
||||||
{
|
{
|
||||||
result = do_io(conn, outfd);
|
result = do_io(conn, outfd);
|
||||||
if (result != 0)
|
|
||||||
{
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (0 > conn)
|
if (0 > conn)
|
||||||
|
Reference in New Issue
Block a user