Ejemplo n.º 1
0
        public ServerPlayer(Socket sock, ServerGame sg)
            : base()
        {
            this.Connected        = true;
            _listening            = true;
            _shouldRemoveFromGame = false;
            _invalidMessages      = 0;
            _hand             = null;
            _currentPhazeRule = null;

            _socket     = sock;
            _serverGame = sg;
            _address    = _socket.RemoteEndPoint.ToString();

            _buffer = new Buffer();

            //start 5 seconds timer for a login message
            Thread t = new Thread(new ThreadStart(this.listenForLogin));

            t.IsBackground = true;
            t.Name         = "Login listener for " + _address;
            t.Start();

            //create new login timer
            new Timer(
                new TimerCallback(this.checkForLogin)
                , null
                , TimingDefinitions.LoginTimeout_Server
                , Timeout.Infinite);
        }
Ejemplo n.º 2
0
 public ConnServer(ServerGame sg, GameRules rules, NetworkSettings settings)
 {
     this.rules    = rules;
     this.settings = settings;
     _serverGame   = sg;
     _port         = this.settings._Port;
     _process      = true;
     try
     {
         _connectionListener = new TcpListener(IPAddress.Any, _port);
         _bound = true;
     }
     catch (Exception e)
     {
         PhazeXLog.LogError(e, GameLibraryVersion.VersionString, 105);
         _bound   = false;
         _process = false;
         throw e;
     }
 }