I saw a post recently asking if there was an easy way to find the port a client was using on a SQL Server since someone had multiple instances. I asked for some information since there are actually multiple ports in use.
The port the SQL Server listens on
The port the client server opens a connection on their side
The first one comes from a few places. It’s easily found in the Configuration Manager GUI as shown below:
These are the TCPIP properties for my service.
Finding the client port, which is probably needed for tracing/troubleshooting, is easy to do as well. You can query sys.dm_exec_connections, and see how clients are connected. I don’t have any TCP connections on my instances, since I am local it’s through shared memory, but here’s where you’d find it in the result set:
I’ve typically not worried about port, but the client_net_address has been valuable to me in the past.