02-28-2018 10:18 AM
Hello,
I have a couple of quick questions about how to use TCP/IP on the cRIO
(1) What IP address/port number I should be using? I've tried using the cRIO's IP and port number, but that keeps giving me errors. I've also tried using the computers IP address, but that also gave me errors
(2) What kind can be shared through TCP/IP? All of our data post processing is done in Python, so if we are able to do the post processing via TCP/IP that would save us a ton of time.
Also, if someone could share a cRIO project that uses TCP/IP with Python that would be extremely helpful!
02-28-2018 12:41 PM
@atokad wrote:
I have a couple of quick questions about how to use TCP/IP on the cRIO
(1) What IP address/port number I should be using? I've tried using the cRIO's IP and port number, but that keeps giving me errors. I've also tried using the computers IP address, but that also gave me errors
The cRIO IP address is correct. Your LabVIEW code needs to open a listener on a particular port, and then you'll be able to connect to it. If you haven't written any code to handle the LabVIEW/cRIO side of the connection, then nothing will work.
@atokad wrote:
(2) What kind can be shared through TCP/IP? All of our data post processing is done in Python, so if we are able to do the post processing via TCP/IP that would save us a ton of time.
Any data you want. In LabVIEW, data sent or received over TCP is a string, but that just means it's a series of bytes. It's up to you to define the content, meaning, and length of those strings of bytes. Take a look at the LabVIEW TCP examples.
02-28-2018 01:22 PM
I'm away from the lab right now, but I think my professor wanted me to have the python working as the server side.
What IP/Port do I use for the Python code? Is it the same for LabVIEW?
02-28-2018 01:52 PM
Same idea regardless of which side is the server and which side is the client. The server starts listening on a particular port, and the client connects to that port. You should definitely use a port number greater than 1023, and probably a port number greater than 49152, but other than that (and that the port number must be less than 65536) you can pick any port number you like.
You don't need to provide an IP address on the server side, unless you have multiple network connections and only want to listen on one of them. The client needs to know the IP address of the server.
03-12-2018 10:49 AM
On the Python side when I try connecting to the computers IP I get an error:
" server.bind(('000.00.00.00', TCP_Port))
OSError: [WinError 10049] The requested address is not valid in its context"
Where 000.00.00.00 is my computers IP address instead