LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Reading multiple ethernet packets via TCP Connection

Hello all, I have a board that is connected to multiple sub-systems. I query the status of all subsystems for every 2 secs and the board send me a packet of 252 bytes size in return. Simultaneously there is feature called scanning which will send a packet of 1460 bytes every second. We can change the timing of scanning packet (i.e; manipulate the rate scan packet to host (labview) like we can set it to 5 sec, 10 sec ....up to 90sec). The issue is sometimes the status packet gets mixed up with the scanning data packet.

0 Kudos
Message 1 of 2
(824 Views)

Well you have two different data streams going through the same communication link:

 

1) a response to a command you send

2) a periodic data packet that is simply busted out on the network without anyone first sending a command to return it

 

These are totally asynchronous from each other and there is no simple way to make sure you receive the response after sending a command rather than the data packet

 

There are two solutions to the problem:

 

1) separate the communication channels, one for the command response protocol part, one for the data blast channel. In TCP this is done by using two different ports to communicate over. You can have both listeners on the same computer or have the command/response listener on the device and add a command to the protocol that passes a network address and port number to the device to which it should connect for the data blaster, after you opened the according listener in your client program.

 

2) seperate the command sender from the receiver in your application. The receiver is a separate task that simply tries to read data from the connection, and determine if it is a data packet or a response packet. Data packets are displayed on screen and/or send through a queue to the data processor. Response packets are send through a different queue.

 

Your command VI sends of the data over the communication channel, then waits on the queue for the response.

Rolf Kalbermatter
My Blog
0 Kudos
Message 2 of 2
(810 Views)