LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Opening Multiple TCP Ports for a Single VI

Hey all,

I'm using a program that requires me to open multiple TCP ports in a single VI at once. I know how to open a singular TCP port, but I don't know how to open any more than one at a time. For this program I need to open TCP ports 50040, 50041 and 50042 all at the same time.

Any advice would be great.

-Cpraz

0 Kudos
Message 1 of 5
(1,888 Views)

Is there a reason you can't drop 3 instances of TCP Open on the same block diagram?


aputman
LabVIEW 2017
LabVIEW Programming
0 Kudos
Message 2 of 5
(1,878 Views)

Thats currently what I have. However, I get an error for whichever ports I haven't specified in the VI server under tool>options.

0 Kudos
Message 3 of 5
(1,863 Views)

Is your VI acting as a client, or a server? If you're accepting connections on those ports (VI is a server), then you need to use the TCP Listener functions. If your VI is acting as a client, then normally the outgoing port number is selected for you automatically.

 

It sounds like you're expecting your VI to act as a server, but you're using the TCP Open function, which establishes a connection to a remote machine rather than waiting for an incoming connection, like a client. By setting the VI Server port number in Options, you're telling LabVIEW to act as a server (and accept incoming connections) on that port, but then you have no control over that port - it expects to send VI Server data, and not the data that your code sends. If your VI is going to act as a server, you cannot have VI Server open the ports that you want to use, because you'll get an error - only one application (or in this case, part of an application) can listen on a port at a time.

 

If I haven't described your problem correctly, please upload your code and the text of the error that occurs.

0 Kudos
Message 4 of 5
(1,848 Views)

I don't know what changed, but this morning this wasn't a problem anymore! Thanks for the help though.

0 Kudos
Message 5 of 5
(1,817 Views)