From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Communicating with multiple Ethernet devices

Niatross_0-1589622813633.png

 

I have had another look at your code and you have not wired the TCP reference through your event structure for the Enable SSDC case. This means that if you enable the SV200 first when you enable the SSDC LabVIEW will effectively forget the SV200 TCP reference because it is reset to default causing all future commands to fail.

 

I tend not the use the 'Use Default if unwired' flag for anything (apart from a few specific examples) to avoid this situation.

 

Having two parallel loops is the way to go definitely. Even better would be to put all of your communications in a seperate VI and communicate with it using a queue. (I would suggest queue communication for parralel loops as well) If the two devices are identical and therefore have the same communication protocol of would reuse the single communication VI (Containing a state machine) and set it to re-entrant 

Niatross_1-1589623603968.png

As I am feeling generous today I have thrown together an example template for you. Warning the rentrant VI's can be a pain to debug but this is the best way (In my opinion) of making clean scalable code.

 

Download All
0 Kudos
Message 11 of 14
(518 Views)

Hello I have same problem. I have two TCP with ip address 192.168.1.150and192.168.1.151.

I need to read  two tcp connection in same time, I used a router to connect two tcp and connect router to computer. Each ip address is read alone but I don't know how read two tcp data in one vi in labview.

0 Kudos
Message 12 of 14
(449 Views)

On the same IP address you only can open each port once. When it is in use any other use by someone else even if it is the same process is disallowed.

 

So if you connect the local port input on TCP Open and don't use different ports, this MUST fail. Why would you even force the local port to anything specific. This is generally completely unneccessary since the initiating side (the client) is not typically bound to use any specific port unless you need to circumvent firewall or similar restrictions.

Rolf Kalbermatter
My Blog
0 Kudos
Message 13 of 14
(435 Views)

@Maryam1368! wrote:

Hello I have same problem. I have two TCP with ip address 192.168.1.150and192.168.1.151.

I need to read  two tcp connection in same time, I used a router to connect two tcp and connect router to computer. Each ip address is read alone but I don't know how read two tcp data in one vi in labview.


By opening two individual connections and handling them seperately. This is the same as you would do in any other programming language.

Rolf Kalbermatter
My Blog
0 Kudos
Message 14 of 14
(432 Views)