This guide is for opening ports:

@ubuntu 16.04 x64 (example of Port 9999)
sudo ufw allow OpenSSH
sudo ufw allow 9999
sudo ufw default deny incoming
sudo ufw default allow outgoing
sudo ufw enable
y
@Windows 10 (example of Port 9999)
- Open the Control Panel in the Windows Start menu
- Select Windows Firewall
- In the left column of Windows Firewall, select Advanced Settings
- In the left column of the Windows Firewall Advanced Options, open the Inbound Rules folder.
- In the right column, select New Rule
- In the new rules creation wizard, select Port and click Next. Do not create a rule for a program, but for a port
- As a protocol, select TCP, select Specific Local Ports, enter 9999 as the port number, and click Next.
- Select Allow connection and click Next
- Select when to apply this rule (select all options here to keep the port open) and click Next
- Give the rule a name and click Finish to add the new rule
- TCP port 9999 is now open and ready to use