LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

data from python to labview tcp

I'm trying to send a simple data from python to labview so that once my client server connection is done, I can expand my code. But when I run my Labview code and Python code my python code throws an error "No connection could be made because the target machine actively refused it". I am not able to figure out the problem also I want the received data to be show in string format.

Download All
0 Kudos
Message 1 of 6
(574 Views)

TCP/IP is not a peer to peer network in itself. That needs to be implemented by higher protocols above it. TCP/IP always has a server (listener) that just sits there and waits for connection requests, and one or more clients that sends connection requests to this listener.

 

You try to connect from both LabVIEW and Python as client to a listener that simply doesn't exist. You can create a listener in LabVIEW by using the Create Listener function. Check the LabVIEW examples for Simple Client and Server examples and similar.

 

You could also create a listener in Python by calling the listen() function instead of connect().

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

Thanks for helping, instead of using "TCP Open Connection" I am using "TCP Create Listener" and now I am able to establish a connection but still the data I am trying to send (Yes) is not showing in "data out" indicator.

JhonnyJhon_0-1716275522215.png

 

0 Kudos
Message 3 of 6
(550 Views)

Did you look at the Simple TCP example in LabVIEW? The listener refnum returned by Create Listener is NOT the refnum on which the communication happens. It is purely for managing the listener socket!

 

You either want to use the TCP Listen function as in the Simple TCP example to work in the trivial way you show now or need to look at the more elaborate TCP Multiple Connections example to see how the Create Listener function works. 

Rolf Kalbermatter
My Blog
0 Kudos
Message 4 of 6
(531 Views)

Yeah, I saw that and used the exact same tcp example for receiving data from my python code still not able to the string data in "data out" indicator of that LabVIEW Example. I can see that data is getting successfully sent to LabVIEW, only thing is that data I can't see in indicator.

0 Kudos
Message 5 of 6
(518 Views)

The Simple TCP example uses the TCP Listen function, a high level VI that combines the TCP Create Listener and the TCP Wait on Listener function. Your example you post only contains the low level function TCP Create Listener. 

Rolf Kalbermatter
My Blog
0 Kudos
Message 6 of 6
(505 Views)