NI TestStand

cancel
Showing results for 
Search instead for 
Did you mean: 

TCP step type Read function extra characters

Hi,

 

I need to develop a system where TS TCP step type (http://www.ni.com/example/26372/en/) should communicate with a unique TCP/IP server application.

Everything is working but I have issue to read short messages receiving from the TCP/IP server.

I receive always extra characters after my valid information even it was not send by TCP/IP server application.

The issue is the same in case of the sample application attached to the step type.

You can see an example in the attached pictures.

No issue in case of longer messages or if the message send from the TS TCP step type to the TCP server.

It looks like it is some kind of buffer issue inside the step.

 

Any idea?


TCPRead.jpgTCPRead_1.jpgTCPRead_2.jpg

0 Kudos
Message 1 of 3
(3,546 Views)

I can confirm the same functinality on my station.  No solution however. But I thought it might be of intrest to you or any one else looking in to the problem. I use windows 7 64 bit  and Teststand 2012

0 Kudos
Message 2 of 3
(3,542 Views)

Hi,

 

I have just realized that the source code is also attached to the dll. Smiley Embarassed
I was able to fix the issue:

/**************************************************************/

TCPerror = ClientTCPRead ((unsigned int) Handle, Data, MaxData, Timeout);
if (TCPerror < 0)
{
//Get TCP Error Message
sprintf(errMsg,"%s",GetTCPErrorString ( TCPerror ));
error = TCPerror;
goto Error;
}
else                                        // add to avoid extra characters at short messages                     
Data[TCPerror] = 0;
/**************************************************************/


Regards,

Message 3 of 3
(3,533 Views)