Port Forwarding FAQ

Port forwarding causes all expected internet communication coming to your home to automatically be redirected to the correct computer in your home.

Who Needs to Set Up Port Forwarding?

When playing one of the Godtland Software multiplayer games, one person in the group (the host) needs to set up and run the game server program on his computer. If you run the game server you have full control over when the game will be played and who will be playing the game. You may start up a game for any group of friends any time you want. However, running the game server may require port forwarding.

  • If someone else is running the game server and you just want to join his game, you do not need to set up port forwarding.
  • If the game server and all the players are in the same home network (all computers are communicating through the same network router), no one needs to set up port forwarding. All players should then connect to the game server using the game server's private IP address.
  • If you want to run the game server on your computer, and players outside of your home network will be joining the game, you must set up port forwarding on your network router.

What Port and IP Address Should You Forward?

Start the game server program. It will display the current port for the game and the private and public IP addresses for that computer. You will use the port and private IP address to set up port forwarding. For example, here is the Contract Whist Server window.

For better security, we recommend that you choose a different port than the default port that came with the program. To change the port:

  1. Click Change Port.
  2. Enter any port number that is not already assigned for use by some other program on that computer. The game server program will suggest an available port. You may enter the suggested port or enter any other number between 1024 and 65535. You may use the same port number for all the Godtland Software games if you so desire but then you will only be able to play one game at a time. Click OK.
  3. If you try to start the server with a port that is already in use, the server will not start, stating an error occurred because that port is already in use. In that case, start the server with a different port number.

Make note of the port and private IP address. You will use those to set up port forwarding. If you decided to use the same port for all the Godtland Software games, you only need to set up port forwarding for that port once.

How do You Set up Port Forwarding?

Please refer to your network router's user manual. If you cannot find your copy of the user manual, you might find instructions online by searching for "how to set up port forwarding in xxxx router" where xxxx is the brand name of your network router. You can get to most network router administration pages by entering your router's private IP address as the URL in an internet browser, often "".

  1. Log in to the administration of your network router with your router username and password. This is usually different from your wi-fi password. You likely either set the router username and password the first time you used your router, or your Internet Service Provider set it and put it on a sticker under your router.
  2. Find the port forwarding options. The port forwarding options are often located in the router configuration options under "Advanced Setup", "Security", "Applications and Gaming", "WAN" (Wide Area Network), "Virtual Servers", or "Features". If you are given choices of single port forwarding, port range forwarding, & port range triggering, select single port forwarding.
  3. Create a new port forwarding rule and activate port forwarding, so any internet communications that come in on the port you set in the game server program is automatically redirected to the private IP address of the game server computer.
    • You may be given an option to name that port forwarding rule. Name it for the game which will be using that port. For example, name it "Contract Whist" if the port will be used for the Contract Whist game. If you want to use the same port for all the Godtland Software games you could name it "Godtland Software Games."
    • You will be asked to enter a local port. Enter the port you set for the game server as instructed above. This will be a number between 1024 and 65535. If you are asked to enter a range of ports, or an external and internal port, enter the same port for both types or ranges.
    • You will be asked to enter the local IP address. Enter the private IP address of the server computer.
    • If you are asked what type of protocol to accept TCP, UDP, or both, select TCP. Only TCP communication is used for the Godtland Software games.
  4. Make sure port forwarding is enabled on your network router.
  5. Turn off, deactivate, or delete the port forwarding rule if you no longer want to use the server program for which you forwarded the port.


Your internet service provider assigns your home network one IP address. This is the public IP address of your entire home network. All devices on a home network share the same public IP address. Each device in your home network is assigned a unique private IP address by your network router. Your router acts as a hardware firewall: it blocks access to the individual devices in your home network, but lets expected communication through specific ports. For example, your router expects communication through ports for email and internet browser activity: port 25 for SMTP, port 80 for HTTP, port 110 for POP3, and port 143 for IMAP.

All players in your game must have their actions reported to the game server program. The server controls the flow of the game and ensures game rules are being followed by all players. The game program of each player simply sends data to a port at your home network's public IP address. The game server simply monitors for any data coming through a port. However, the game server is inside your home network and your network router blocks any unexpected communication coming into your home network. Therefore, you have to configure your router to expect communications on that port and forward such requests to your server. Port forwarding causes all requests coming to a specific port of your public IP address to automatically be redirected to that port at a private IP address.

Yes, one of the players may play the game on the same computer on which the game server program is running. However, that player should connect to the server using the private IP address instead of the public IP address, otherwise other players may not be able to connect to the game server and will get an error saying that the server is not running.

Yes, you may simultaneously run multiple game server programs on one computer. However, each game server must be set to use a different port. You may even host multiple groups of people playing the same game at the same time as long as you use a different port for each running server.

If a player entered the incorrect port or IP address, he will get an error stating that the server is not running.

If a player entered his name incorrectly, he will get an error message stating that he was not invited to the game or his name is being used by someone else. Note, he must enter his name exactly as it was entered for the game server program. It is case sensitive. Each player in the game must have a unique name.

If your game server is running and the players entered the correct port, IP address, and name, and they still get an error message stating that the game server is not running, communication is being blocked within your computer network setup.

  1. Your public IP address may change over time.
    • Your public IP address is assigned by your internet service provider (ISP). If you get a new ISP, you will be assigned a new public IP address.
    • Some ISPs may occasionally change the public IP address for your account. If players are not able to connect to your game server and the server indicates it is running, check to see if your public IP address changed. You may be able to request a static IP address for your account if you want an IP address that will never change.
    • Some ISPs share one public IP address across several accounts. If that is the case with your ISP, you won't be allowed to do port forwarding and must request a static IP Address for your account in order to host these games. Otherwise, you may still play the games but you will have to find someone else in your group to run the game server.
    • If your public IP address changes, you will need to give your new public IP address to all the players who are not within your home network.

  2. Your private IP address may have changed.

    If you reset or replaced your network router, or switched between a cabled Ethernet connection and a Wi-Fi connection, that computer may be assigned a new private IP address. Start the game server to see its current private IP address, then make sure your router forwards communication to the current IP address.

  3. A software firewall may be blocking communication.

    A software firewall might block communication between computers within your private network. For example, do you have the Windows Defender firewall turned on? Or do you have some other firewall running on your computer, such as one that might come with your antivirus software? If so, change the settings of your firewall software to allow the game you are trying to play through the firewall on your game server. If you do not see the game listed, your firewall may be blocking all Java applications. In that case, try allowing Java through your firewall.

    Do I need a software firewall if I have a hardware firewall? The hardware firewall blocks access from outside your network. However, it does not block access between computers within your network. A software firewall will protect your computer if another computer in your network gets infected and tries to spread malware throughout your network.

  4. If one of the players is playing the game on the server computer, he should log in to the game using that computer's private IP address instead of its public IP address.

A port is not an all-access pass to your computer. It only gives access to the server program that is listening on that port. Allowing access through the hardware firewall via port forwarding is only a risk if a hacker comes across your open port. And even then, there is only a risk if a server program is currently listening on that port and a hacker is able to trick the listening server program into doing something malicious with what that program is able to do, or if a hacker manages to get his own program installed onto your computer and get it to listen on that port.

Your network router always lets communications through for many other ports provided by your computer. For example, as stated above, several ports are always open for email and internet browser acivity. Email and internet browser software have the ability to access much of your computer data and data you enter into those programs may be sensitive. Therefore email and browser program providers send out updates as new security risks are discovered.

The Godtland Software multiplayer games cannot access any data on the computer and anything you enter while playing a game does not have any usefulness outside of the game. So the Godtland Software games running on a port should not present much of a security risk. However, extra precautions you can take include:

  • Choose a random port for each of the game servers to prevent some other program from knowing which port you might have open.
  • Stop the server when you aren't playing a game.
  • Use an antivirus program.
  • If you don't have a good antivirus program, disable port forwarding to the game server whenever the game server is not running.

Another way to get the private IP address of a computer is to enter "ipconfig" in the command prompt window on that computer. To open a command prompt in Windows 10, click Start / Windows System / Command Prompt or enter "command prompt" in the search box in the Windows taskbar. The private IP address will be listed as the IPv4 address.

Another way to check the public IP address for a computer is to use that computer's internet browser to go to http://checkip.amazonaws.com/ or http://icanhazip.com/. You will be shown the public IP address for that computer. The public IP address will be the same for all computers in a private network.

Learn to Write Your Own Computer Games

Click the book image to find the book on Amazon.

Do-It-Yourself Java Games: An Introduction to Java Computer Programming

More Do-It-Yourself Java Games: An Introduction to Java Graphics and Event-Driven Programming

Advanced Do-It-Yourself Java Games: An Introduction to Java Threads and Animated Video Games

Do-It-Yourself Multiplayer Java Games: An Introduction to Java Sockets and Internet-Based Games

Get quantity discounts with Free Shipping when you order 5 or more copies of any book directly from us.