Exemple #1
0
        private static MasterServerConfiguration CreateParametersFromCommandLine(string[] args)
        {
            var configuration = new MasterServerConfiguration
            {
                MaxGameSessions = 10,
                Port            = 11175,
                LogListener     = new ConsoleOutput(),
                Threads         = 1,
            };

            return(configuration);
        }
Exemple #2
0
        public MasterServer(MasterServerConfiguration masterServerConfig)
        {
            Tracer = masterServerConfig.LogListener;

            _clientManager = new ClientManager(masterServerConfig.MaxGameSessions * 4);
            _sessionPool   = new SessionPool(masterServerConfig.MaxGameSessions);

            Tracer.PrintInfo(string.Format("Starting NetServer at Port: {0}", masterServerConfig.Port));
            var parameters = new NetworkServerHandlerParameters
            {
                ApproveConnection         = ApproveConnection,
                HandleClientJoined        = HandleClientJoined,
                HandleClientLeft          = HandleClientLeft,
                HandleDataMessageReceived = HandleDataMessageReceived,
                Port = masterServerConfig.Port
            };

            _networkServerHandler = new NetworkServerHandler(parameters);
            Tracer.PrintInfo("Server started successfully.");
        }