April 18, 2018 306 views
Applications Deployment Initial Server Setup Linux Commands Ubuntu 16.04

Hi All,

I made a unity Multiplayer Game similar to POKER Game.
I have the game running on local machine with unity's default local IP and port.
I am able to create room,players can join room.

I am using Master Server Kit for managing Server side on local.

From my understanding i have use my droplet's IP and Some open Port to access the server.

But as i don't have server side understanding, i would be very thankful if some can give me reference material on how to :

  1. Open port in digital ocean Ubuntu 16.04.
  2. Where to put my ZoneServer.exe,RoomServer.exe,and WorldServer.exe in filesystem?
  3. How can i access suppose ip:port/Zoneserver.exe

So far, i have tried numerous solutions, but none worked.

Usually, i would create a game and test it on Local Machine only.

1 Answer
ryanpq MOD April 18, 2018
Accepted Answer

Hi! While I haven't worked with the Master Server Kit I just happen to have been playing with Unity networking, running a server for a game I'm building as a hobby. I think I can help clarify things for you:

Open port in digital ocean Ubuntu 16.04.

By default your ports will be open. When you are ready to set up a firewall this guide will walk you through the process.

Where to put my ZoneServer.exe,RoomServer.exe,and WorldServer.exe in filesystem?

You can place them anywhere. Personally I have two server systems for my game and store them in folders under /opt like /opt/gameserver1 and /opt/gameserver2 but that's just my preference.

One thing to note is that you'll need to build the server for Linux. On the build settings screen select Linux 64 bit and check the box for headless mode. This allows your server to start up from the command line without the need for a graphical environment.

How can i access suppose ip:port/Zoneserver.exe

You won't have to direct your connection to the name of the executable. When you start your server it will bind to the port specified and all connections to that port would then go to your Zoneserver. Here is the connection string I am using in my project...

using UnityEngine;
using UnityEngine.Networking;

public class main_loader : MonoBehaviour {
   NetworkClient myClient;

   void Start() {
      if (SystemInfo.graphicsDeviceID == 0){
            isServer = true;
        else {
            isServer = false;

   void startClient () {
      myClient = new NetworkClient();
      myClient.RegisterHandler(MsgType.Connect, OnConnected);
      myClient.Connect("server.example.org", 4242);

   void startServer() {


The Start() section will determine if the code is running as a client or a server by checking if there is a graphics device. Since only the server is built to run headless this is a reliable method. Then if the code determines it's a server it will run startServer() which begins listening on port 4242. If it detects that it's a client it will try and connect to the server at "server.example.org" on port 4242.

by Shaun Lewis
Learn how to setup a firewall with UFW on an Ubuntu / Debian cloud server.
  • I should note that this code as shown will throw an error unless you create an "OnConnected()" function to be called when the client makes a connection.

  • Thanks A Lot, your answer did solve many of my Questions.

Have another answer? Share your knowledge.