I'm using dm648 ndk v2.0.0 to send raw image(size : 1200*1600*2,frame rate: 3 frames/sec,tcp protocol), but meet some problems:
By calling socket function send,every time we send NET_MAX_PACKET_SIZE bytes(maximum),
the code as follows:
while(nLeft > 0)
{
if(nLeft < NET_MAX_PACKET_SIZE)
nSent = nLeft;
else
nSent = NET_MAX_PACKET_SIZE;
if((nSent = send(nSock, (void *)pBuf, nSent, nFlags)) < 0)
{
NetLog_error1("sendn, send data error: %d.", fdError());
return NET_API_EFAIL;
}
else if(nSent > nLeft)
{
NetLog_error("sendn, Send Data Error, send size > left.");
return NET_API_EFAIL;
}
nLeft -= nSent;
pBuf += nSent;
}
1、if NET_MAX_PACKET_SIZE = 1664, the send will go wrong in 1 minutes , we can't ping the bord ! when NET_MAX_PACKET_SIZE = 1024, the code can run correctly!
2、if the send buf pBuf is in cache, the send can't runing 8 hours, it maybe disconnect in some time,and we can't ping the bord again. if the send buf is in nocache, the dsp can
run more than 24 hours without connect error!
3、by using socket api function setsockopt( pInfo->nSocket, SOL_SOCKET, SO_SNDBUF, &size, sizeof(size) ) to set the sendbuf to 16K,the send will go wrong in 1 minutes!
Has anyone ever had such problems, or know a way to solve it.
Thanks for your help!