LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Catch malformed tcp ip packets

Hello,

 

I made an application in LabVIEW 2012 32bit, that communicates with an xPC Target through the xPCAPI dll from Simulink Real Time. The communication is made with TCP/IP and I'm using the Call Library Function Node to access the dll.

 

I request an array of signals to the xPC Target every 500ms and my LabVIEW application works fine for a period of time that can be 3 minutes to an hour and then LabVIEW just closes.

 

We catched the error message from the xPC, which seems to be causing LabVIEW to crash and it is "Deformed message" error. (It also has the "TCP/IP Read Error").

 

I'm not very experienced with Networks, does anybody know how this error is produced and if I can catch it so my main application won't crash?

 

Thank you!

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

Hi!

Handling of malformed TCP packets should be handled by TCP itself and should not bother Labview.

Can you share the Labview code you use to read from the network?

 

Regards,

Marco

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

Hi Marco,

 

I found out what is causing the problem, but still can't figure out how to fix it.

I'm not using the TCP/IP communication VIs from LabVIEW, but a call function library node for the xPC dll.

That DLL has a connection function and a set of functions to communicate with the xPC Target using an ID generated with the connection function.

 

After the connection is stablished, I start requesting information from the xPC every 500ms (so my code is basecally that call of the function inside a while).

The parameters of my function are a vector data pointer for the values, an array with the ID of the signals I'm requesting and the number of signals (array size).

 

Everything is fine until an error appears (I've seen TCP/IP Error or Malformed Message) this can be after 30 minutes, 1 hour, 2 hours, it seems to appear faster, if I reduce the delay between calls.

 

In the call of the function with error, i receive an array of zeros for my values. In the next call I receive the previous values that I didn't get because of the error, so I get some kind of offset between the calls of the function and the answer of the function:

Request 1 --> Answer 1

Request 2 --> Answer 2

Request 3 --> Error

Request 1 --> Answer 3

Request 2 --> Answer 1

 

I try disconnecting and reconnecting to clean the data queue, and though it seems to work, the problem reappears until i can't reconnect anymore.

 

I'm not sure what is causing the error, so any idea or suggestion is welcome!

0 Kudos
Message 3 of 3
(3,077 Views)