test-tcp: Fix printing of "connection reset" when tcp connection closed
This commit is contained in:
parent
31568fc5a1
commit
f538dd5276
|
@ -99,10 +99,9 @@ int main(int argc, char** argv)
|
||||||
{
|
{
|
||||||
ssize_t nrecv = recv(socket, buffer, sizeof(buffer), 0);
|
ssize_t nrecv = recv(socket, buffer, sizeof(buffer), 0);
|
||||||
if (nrecv == -1)
|
if (nrecv == -1)
|
||||||
{
|
|
||||||
perror("recv");
|
perror("recv");
|
||||||
|
if (nrecv <= 0)
|
||||||
break;
|
break;
|
||||||
}
|
|
||||||
write(STDOUT_FILENO, buffer, nrecv);
|
write(STDOUT_FILENO, buffer, nrecv);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue