UaExpert keep port busy

Questions regarding the use of the UaExpert.

Moderator: uaexpert

Post Reply
gianmarco.righi
Jr. Member
Jr. Member
Posts: 1
Joined: 15 Nov 2023, 16:14

UaExpert keep port busy

Post by gianmarco.righi »

I have a server developed with UnifiedAutomation SDK (version 3.4.1) that works on 41969 port.
I connect UaExpert (version 1.7.1) to it and everythings works well.
When I close the server sometimes UaExpert keep 41969 port busy, as shown in PerformanceMonitor:

Image

This makes problems if I start server again. Server cannot connect to port.
I tried to close connection manually before quit server, but it doesn't works:

Code: Select all

UnifiedAutomation.UaServer.Session session = (Session)item.Tag;
session.Close();
session.Dispose();
Any suggestions?
Thanks

User avatar
Support Team
Hero Member
Hero Member
Posts: 3072
Joined: 18 Mar 2011, 15:09

Re: UaExpert keep port busy

Post by Support Team »

Hi,

the root cause of this is hard to estimate with this little information.

If you "gracefully" close the server (real shutdown), the server will close all connections and shut down, including closing the socket and TCP connection of all endpoints being used. However when you "kill" the server, or when the server could not close the socket (because it is blocked or hang, or being busy), you must wait until the operating system timeout finaly releases the resource. Such timeout might be different on different Windows and on Linux systems, and is outside the control of the UA server (it is an operating system feature).

As long as the port is "in use" by the previous application instance, you can not restart. On Windows with .NET SDK one application is exclusively using the port (you need to check if previous server instance is really gone).

With "netstat -a" on the command promt you can list the used ports (in listen mode) and see which application is using them and how long. In any case the graceful shutdown is typically the fastest way to "free" the port and get it again after restarting the application instance.
Best regards
Unified Automation Support Team

Post Reply