I was not sure if this was implemented already so I checked the help file and figured it was not:

A lport property for the sock identifier that returns the port used by a socket on the local machine, ie local port.