It is up to you to specify the listening port for your server side application because the client side has to know to which port it should try connecting to.
As ports range 1-1024 is reserved for system services (this is just by convention, not a rule) you can pick any port from (1024, 65535]. If the port you have selected is occupied by another application, it will just throw an exception. If you do not specify the port number, it will be randomly generated.