LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Question about two TCP connections established "by default" by LabVIEW EXE on Windows

Hi,

 

Does anyone know why a LabVIEW EXE on Windows establishes two TCP connections - over ports 61524 and 61525 - without being programmed to do so? What is the purpose of these connections, and can they be turned off/disabled?

 

Below is a screenshot of the TCPView tool in which you can see the two TCP connections of my EXE.

Petru_Tarabuta_0-1723468059505.png

 

Background: I'm creating a LabVIEW Windows EXE that uses TCP communication to communicate with another EXE. At its lowest level the application uses the LabVIEW TCP primitives (TCP Open, TCP Read, TCP Write) to establish a connection and send/receive data. When testing the application, using TCPView I noticed that two TCP connections are established by the EXE as soon as it is launched. This is before the application establishes "its own" connection (the connection I programmed it to establish). When that additional connection is established I can see it in TCPView on a different port, in addition to the two "default" connections, as expected.

 

In summary I'm curious what the two "default" connections represent, and how they can be turned off. I would like the EXE to establish exactly one TCP connection.

 

LabVIEW Version: LabVIEW 2024 Q3 64-bit

OS Version: Windows 11 64-bit

 

Thanks!

0 Kudos
Message 1 of 15
(742 Views)

My immediate thoughts are VI Server and Debug Server.  I would have to do some digging to check that.

 

You could make sure you turned off debugging in the build specification for the application and see if that eliminates one or both of those connections.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 2 of 15
(737 Views)

Thanks. I too suspected VI Server. Is there a way to disable the TCP comms ability of VI server from built EXEs?

 

"Enable debugging" is already turned off in the build spec, as seen below.

Petru_Tarabuta_0-1723472152899.png

 

0 Kudos
Message 3 of 15
(712 Views)

Here are some keys I tend to add to my executables.  I would need to give LabVIEW Wiki a visit to see what all of these do.  But I suspect a couple of them will turn the debug server and VI server off.  Most of these I just took from a default build ini file.  The font keys I found and use due to font issues I had when going between XP and Windows 7.  The return key action I found in LabVIEW.ini and it also worked in my executables.

server.app.propertiesEnabled = True
server.ole.enabled = True
server.tcp.paranoid = True
server.tcp.serviceName = "My Computer/VI Server"
server.vi.callsEnabled = True
server.vi.propertiesEnabled = True
DebugServerEnabled = False
DebugServerWaitOnLaunch = False
appFont = "Segoe UI" 13
dialogFont = "Segoe UI" 13
systemFont = "Segoe UI" 13
returnKeyAction = True

 


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
Message 4 of 15
(694 Views)

Thanks.

 

Initially the EXE was using the following INI settings:

2 The initial EXE INI settings.png

 

 

 

 

 

 

 

 

 

I replaced those settings with the settings you kindly shared, as seen below:

3 The settings shared by crossrulz.png

 

 

 

 

 

 

 

 

 

 

 

 

 

This DID NOT change the behaviour - the two "default" TCP connections continued to be established immediately after launching the EXE, as seen below:

4 Still two connections - ports 64417 and 64418.png

 

 

 

 

 

 

 

 

 

 

Notice that the Local Port and Remote Port indicate ports 64417 and 64418.

 

Restarting the EXE (without changing the INI file settings) resulted in the following:

5 Still two connections - ports 50316 and 50317.png

 

 

 

 

 

 

 

 

 

 

Notice that the ports are now 50316 and 50317.

 

In short, changing the INI settings did not stop the connections from being established. A new behaviour was observed: The connections always use two consecutive port numbers, but those port numbers change (seemingly randomly) each time the EXE is launched.

0 Kudos
Message 5 of 15
(655 Views)

Well it is not 2 connections but only one. TCPView shows the sockets (endpoints) the application has opened. And as you can see the endpoint remote and local address/port combination are simply exchanged. So it is in fact establishing a connection with itself. That the ports change between invocations means that they are dynamically allocated.

 

You do not define a specific port number for the VI Server port but instead a service name. A service name means that LabVIEW will allocate a socket on a dynamic port (specifying 0 as port number when creating the listener socket for the VI server which tells Windows to allocate any port that is still available). After that it registers the actually assigned port with the service name at the NI service locator. It seems that it for some reasons also establishes a connection to that service name, most likely for verification purposes that the listener socket works and the registration was successful. For some reasons it then lets that connection open, not quite sure why.

 

You could try to specify an explicit port number in the VI Server settings for your project target specification or disable VI Server altogether to see if that makes any change.

rolfk_0-1723535674499.png

 

 

Rolf Kalbermatter
My Blog
Message 6 of 15
(641 Views)

"Well it is not 2 connections but only one. TCPView shows the sockets (endpoints) the application has opened. And as you can see the endpoint remote and local address/port combination are simply exchanged. So it is in fact establishing a connection with itself. That the ports change between invocations means that they are dynamically allocated." - Thanks, that all makes sense.

 

The first two screenshots below show the existing VI Server configuration of the My Computer target:

6.png

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

7.png

 

As can be seen, the TCP/IP tickbox was already unticked. The Machine Access, Exported VIs and User Access lists were empty.

 

I unticked the four tickboxes in the Accessible Server Resources category and rebuilt the EXE. This did not change the behaviour - the connection is still present - as seen below.

 

8.png

 

 

 

 

 

 

 

 

 

 

In short, I still don't know what is the purpose of that connection, or how to prevent it from occurring. It's not a showstopper by any means - it's mostly a curiosity - but I wish that LabVIEW by default did not open any connections, and if it did, it would explain what the connection is doing and how to disable it.


All the EXEs discussed in this thread so far were built in LabVIEW 2024 Q3 64-bit. I wonder if the same behaviour occurs in other versions.

0 Kudos
Message 7 of 15
(622 Views)

@Petru_Tarabuta wrote:


All the EXEs discussed in this thread so far were built in LabVIEW 2024 Q3 64-bit. I wonder if the same behaviour occurs in other versions.


I checked five executables of mine which I build with LabVIEW 2022Q3 32Bit. They all open one TCP connection to itself. None of my tested executables uses a  TCP connection.

Message 8 of 15
(614 Views)

There's additional services run in the background that LV connects to over TCP. Stuff like help server would show up like this. You can look at the Service Locator dumpinfo to see what's listed on that port while LabVIEW is open.

 

https://knowledge.ni.com/KnowledgeArticleDetails?id=kA00Z0000019KpQSAU

 

I hope that's the KB I think it is... Currently not loading for me 😏

~ G stands for Fun ~
Helping pave the path to long-term living and thriving in space.
Message 9 of 15
(586 Views)

@IlluminatedG wrote:

There's additional services run in the background that LV connects to over TCP. Stuff like help server would show up like this. You can look at the Service Locator dumpinfo to see what's listed on that port while LabVIEW is open.

https://knowledge.ni.com/KnowledgeArticleDetails?id=kA00Z0000019KpQSAU 


Thanks for the link, I learned something new.

 

I opened two executables of mine, but nothing showed up in the 'Service Locator URL Mappings' list.

Message 10 of 15
(569 Views)