05-21-2024 01:47 AM
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.
05-21-2024 02:03 AM
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().
05-21-2024 02:12 AM
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.
05-21-2024 03:20 AM
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.
05-21-2024 04:08 AM
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.
05-21-2024 05:21 AM
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.