private void WaitForConnection()
        {
            Console.WriteLine("Waiting for other player...");
            socket    = tcp.AcceptSocket();
            connected = running = true;
            Console.WriteLine("Opponent has joined the game");
            GameSetupState state = new GameSetupState();

            Program.SwitchState(state);
            state.HandleCommand(true, "opponent_name", new List <string>()
            {
                Globals.localUser.GetName()
            }, "");
            Thread thread = new Thread(ConnectionListener);

            thread.Start();
        }
        public override void HandleLocal(string command, List <string> args, string line)
        {
            switch (command)
            {
            case "host": {
                NetConnection connection = new Server();
                if (!connection.initialized)
                {
                    Console.WriteLine("Server could not be created");
                    return;
                }
                Program.connection = connection;
            }
                return;

            case "join":
            {
                if (args.Count <= 0)
                {
                    Console.WriteLine("Ip not set");
                    return;
                }

                IPAddress ip;
                if (!IPAddress.TryParse(args[0], out ip))
                {
                    Console.WriteLine("Bad ip adress");
                    return;
                }

                Console.WriteLine("Sucessfully joined server");
                Program.connection = new Client(ip);
                GameSetupState state = new GameSetupState();
                Program.SwitchState(state);
                state.HandleCommand(true, "opponent_name", new List <string>()
                    {
                        Globals.localUser.GetName()
                    }, "");
            }
                return;
            }
            base.HandleLocal(command, args, line);
        }