@Override
    public void run() // read server messages and act on them.
    {
        try {
            DatagramSocket socket = new DatagramSocket(udpPort);
            serverReceiveThread = new ServerReceiveThread(registry, gameController, socket, udpPort);
            serverReceiveThread.start();
        } catch (IOException e) {
            gameController.showMessage("Error", "Couldn't accept connection...");
            return;
        }

        doServer();

        if (serverReceiveThread != null) {
            serverReceiveThread.setRunning(false);
        }

        return;
    }