I am trying to simulate a client/server scenario on my home network. To setup the socket connections, i require unused ports. For safety reasons these ports are closed.
What criteria should be followed when picking a testing port on a home network? (for example, if I was to pick port 5469, how would I know it does not conflict with another application).
I realise that I would have to open up this port on my client device, as well as my server (device), and most probably my router.
How can I safely open up a random port on all these 3 devices and only allow them to accept and hold connections from within my own home network?
How would I prevent someone from the internet from simply port-scanning my router and seeing there is an exploitable port?
If your testing only involves devices that are located behind your router (ie on your LAN) then you will not need to open any ports on your router. This means you will be safe from external port scanning.
If you are running any firewalls on your devices then you will need to add an exception for this port, otherwise you should already be good to go.
You can test your configuration by using telnet or netcat (depending on your os and your installed applications).