Beispiel #1
0
 // Creates and starts a new server
 public Server(IGameStateEngine stateEngine)
 {
     GameStateEngine.Set(stateEngine);
     _tcp               = new TcpListener(IPAddress.Any, stateEngine.Game.HostUri.Port);
     _handler           = new Handler(stateEngine.Game.GameId, stateEngine.Game.GameVersion);
     _connectionChecker = new Thread(CheckConnections);
     _connectionChecker.Start();
     Start();
 }
Beispiel #2
0
 // Creates and starts a new server
 public Server(IGameStateEngine stateEngine)
 {
     GameStateEngine.Set(stateEngine);
     Log.InfoFormat("Creating server {0}", stateEngine.Game.HostUri);
     _tcp               = new TcpListener(IPAddress.Any, stateEngine.Game.HostUri.Port);
     _handler           = new Handler(stateEngine.Game.GameId, stateEngine.Game.GameVersion, stateEngine.Game.Password);
     _connectionChecker = new Thread(CheckConnections);
     _connectionChecker.Start();
     Start();
 }
Beispiel #3
0
        // Start the server
        private void Start()
        {
            // Creates a new thread for the server
            _serverThread = new Thread(Listen)
            {
                Name = "OCTGN.net Server"
            };
            // Flag used to wait until the server is really started
            var started = new ManualResetEvent(false);


            // Start the server
            _serverThread.Start(started);
            GameStateEngine.Get().SetStatus(EnumHostedGameStatus.GameReady);
            started.WaitOne();
        }