コード例 #1
0
ファイル: Server.cs プロジェクト: corefan/yad2
        public Server(int PortNumber)
            : base()
        {
            _portNumber = PortNumber;
#pragma warning disable 0618
            _listener = new TcpListener(_portNumber);
#pragma warning restore 0618
            try {
                _listener.Start();
            }
            catch (SocketException) {
                MessageBox.Show("Port that server uses is used by different process");
                _serverEnd = true;
            }

            InfoLog.WriteInfo("Server listnening started successfully", EPrefix.ServerInformation);

            _playersUnlogged  = new Dictionary <short, Player>();
            _playerCollection = new Dictionary <short, Player>();

            MessageHandler = new MenuMessageHandler(this);
            MessageHandler.SetSender(_msgSender);

            StartMessageProcessing();

            _chat        = new Chat(_msgSender);
            _gameManager = new GameManager(this, _msgSender);

            InfoLog.WriteInfo("Server menu message handling started successfully", EPrefix.ServerInformation);
        }
コード例 #2
0
        public Server(int PortNumber) : base()
        {
            _portNumber = PortNumber;
            _listener   = new TcpListener(_portNumber);
            _listener.Start();
            InfoLog.WriteInfo("Server listnening started successfully", EPrefix.ServerInformation);

            _playersUnlogged  = new Dictionary <int, Player>();
            _playerCollection = new Dictionary <int, Player>();

            _msgHandler = new MenuMessageHandler(this);
            _msgHandler.SetSender(_msgSender);
            StartMessageProcessing();

            _chat = new Chat(_msgSender);
            InfoLog.WriteInfo("Server menu message handling started successfully", EPrefix.ServerInformation);
        }