This widget could not be displayed.

Real-Time Measurement and Control

cancel
Showing results for 
Search instead for 
Did you mean: 

multiple tcp connections to same Ethernet card

Solved!
Go to solution

I am working on a somewhat complex control system application, in a Host/RT setup.  Both the host and RT are currently state machines, which is nice for them being nice causal loops, but lousy for trying to control multiple pieces of hardware at once.  

 

I don’t have time to redo the whole setup of the system (we have something like 400 vi’s in our application currently).  What I would like to do is add a parallel loop into the RT which can control some of the non critical systems independent of what the main loop is doing.  

 

Is it possible to have multiple TCP connections open on the same network card?  I would think you just connect to a different port.  Is there a possibility for bad behavior if you’re running like this?

0 Kudos
Message 1 of 6
(4,687 Views)
Solution
Accepted by topic author Taylor.Kendall

Yes, no problem, just as you said, generate a different port for each unique connection.

Message 2 of 6
(4,676 Views)

I thought so, just wanted to check and see what other people had doen with apps like that. 

 

Thank you

0 Kudos
Message 3 of 6
(4,667 Views)
You should be aware that by accessing the network card with multiple TCP connections from multiple loops on your RT system, you may affect the timing and determinism of your main loop. The TCP connection is a shared resource and as such can cause arbitration. For example if your second loop is currently reading data from TCP and your main loop then gets to its TCP Read fucntion, the main loop has to wait until the data is returned from the TCP Read function to the diagram of the second loop, before it can switch back to the main loop.
authored by
Christian L, CLA
Systems Engineering Manager - Automotive and Transportation
NI - Austin, TX


  
Message 4 of 6
(4,645 Views)

Good point, I would suggest using the 'Immediate' Mode in the TCPIP Read function which will return directly with

any received bytes in the buffer.

Message 5 of 6
(4,643 Views)

Good call.  I figgured that one out the first time I tried it, seemed so eay, a bit to easy.

 

 

Nice thing about our process is that there is really only one state where I have time cirtical opperations occouring in the main loop and so I just throw the secondary loop into a holding state where it uses minimal resources and dosnt access the TCP functions.  

0 Kudos
Message 6 of 6
(4,641 Views)