how could I get the port of the client that is connecting to the c# application?
Assuming you have a System.Net.Sockets.Socket object, Type-cast its RemoteEndPoint property to an IPEndPoint and then read its Port property.
System.Net.Sockets.Socket
RemoteEndPoint
IPEndPoint
Port