With DEBUG on, it may require some looping to read all data
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@383 42af7a65-404d-4744-a932-0658087f49c3
This commit is contained in:
parent
5d7b5add5d
commit
8c0dd44a5e
@ -64,6 +64,7 @@ void send_client(void)
|
|||||||
int nbytessent;
|
int nbytessent;
|
||||||
#ifndef CONFIG_EXAMPLE_NETTEST_PERFORMANCE
|
#ifndef CONFIG_EXAMPLE_NETTEST_PERFORMANCE
|
||||||
int nbytesrecvd;
|
int nbytesrecvd;
|
||||||
|
int totalbytesrecvd;
|
||||||
#endif
|
#endif
|
||||||
int ch;
|
int ch;
|
||||||
int i;
|
int i;
|
||||||
@ -141,24 +142,31 @@ void send_client(void)
|
|||||||
}
|
}
|
||||||
else if (nbytessent != SENDSIZE)
|
else if (nbytessent != SENDSIZE)
|
||||||
{
|
{
|
||||||
message("client: Bad send length=%d: %d\n", nbytessent);
|
message("client: Bad send length: %d Expected: %d\n", nbytessent, SENDSIZE);
|
||||||
close(sockfd);
|
close(sockfd);
|
||||||
exit(-1);
|
exit(-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
message("client: Receiving...\n");
|
totalbytesrecvd = 0;
|
||||||
nbytesrecvd = recv(sockfd, inbuf, SENDSIZE, 0);
|
do
|
||||||
message("client: Received %d bytes\n", nbytesrecvd);
|
{
|
||||||
|
message("client: Receiving...\n");
|
||||||
|
nbytesrecvd = recv(sockfd, &inbuf[totalbytesrecvd], SENDSIZE - totalbytesrecvd, 0);
|
||||||
|
|
||||||
if (nbytesrecvd < 0)
|
if (nbytesrecvd < 0)
|
||||||
{
|
{
|
||||||
message("client: recv failed: %d\n", errno);
|
message("client: recv failed: %d\n", errno);
|
||||||
close(sockfd);
|
close(sockfd);
|
||||||
exit(-1);
|
exit(-1);
|
||||||
|
}
|
||||||
|
totalbytesrecvd += nbytesrecvd;
|
||||||
|
message("client: Received %d of %d bytes\n", totalbytesrecvd, SENDSIZE);
|
||||||
}
|
}
|
||||||
else if (nbytesrecvd != SENDSIZE)
|
while (totalbytesrecvd < SENDSIZE);
|
||||||
|
|
||||||
|
if (totalbytesrecvd != SENDSIZE)
|
||||||
{
|
{
|
||||||
message("client: Bad recv length=%d: %d\n", nbytesrecvd);
|
message("client: Bad recv length: %d Expected: %d\n", totalbytesrecvd, SENDSIZE);
|
||||||
close(sockfd);
|
close(sockfd);
|
||||||
exit(-1);
|
exit(-1);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user