I am trying to establish TCP/IP communication between DSP(that runs Code Composer Studio, an IDE to compile and run C code) and Host PC(that runs VC++ application).
While i am sending the data from CCS to VC++, "Retransmission timeout" occurs, and at another instance "Persist timeout" occurs which stops the TCP/IP communication.

Am using CAsyncSocket class and its member functions for TCP/IP Communication.

How to address these errors in VC++?

Recommended Answers

All 4 Replies

> I am trying to establish TCP/IP communication between DSP and Host PC
Just so we're clear - the IDE's are just being used to edit and compile the code right?

They're not actually necessary to the function of sending a message through TCP/IP when the code you've written is running.

Without seeing some actual code, it's hard to say what could be going on.

The following is TCP send function which is implemented through the board support library function of CCS,

err = SVS_TCP_send(activeSck, 921600,(char*)rgbImg.ucBmpData, &sent);
if(err != 0)
{
printf("Error sending image\n");
}
printf("the no.of bytes that are sent = %d\n",sent);

In vc++, the following code is run to receive the data

done=0;
len=921600;
tot=0;
while(!done)
{	
 iRcvd=m_sConnectSocket.Receive(&imgBuf[tot],len-tot,0);

	for(i=0;i<iRcvd;i++)
	{
	arr[tot+i] = imgBuf[i+tot];
	}
	tot+=i;
	if(tot==len)
	{
	  done=1;		  
	}	
}

the retransmission timeout occurs in CCS

> err = SVS_TCP_send(activeSck, 921600,(char*)rgbImg.ucBmpData, &sent);
What do you get returned in sent?
Or err for that matter.
Is your buffer really 900K long?

> iRcvd=m_sConnectSocket.Receive(&imgBuf[tot],len-tot,0);
is imgBuf also 900K long?

What about the array you're copying it into?

Is it just a size problem, like it works for much smaller sizes (say 1K)?
If so, is there a cut-off where it starts going wrong?

the sent value is all the 921600 bytes.(image size is 640 *480*3) the imgBuf size is also 900k.
the problem is not with the size of the image. It works most of the time. sometime timeout occurs.

persist timeout occurs when the client doesnt receive the value at all. the tcp communication also fails.
So this problem should tackled at the client(vc++) side. what kind of exception handling or reception procedure should be followed in vc++?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.