示例#1
0
        public ClientConnection(ITransport transport, ZkLobbyServer server)
        {
            this.server    = server;
            number         = Interlocked.Increment(ref server.ClientCounter);
            this.transport = transport;

            transport.ConnectAndRun(OnCommandReceived, OnConnected, OnConnectionClosed).ConfigureAwait(false);
        }
        public ClientConnection(ITransport transport, ZkLobbyServer server)
        {
            this.server    = server;
            number         = Interlocked.Increment(ref server.ClientCounter);
            this.transport = transport;

            challengeToken = Guid.NewGuid().ToString(); // generate random challenge token

            transport.ConnectAndRun(OnCommandReceived, OnConnected, OnConnectionClosed).ConfigureAwait(false);
        }
        public ClientConnection(ITransport transport, ZkLobbyServer state)
        {
            this.state     = state;
            number         = Interlocked.Increment(ref state.ClientCounter);
            this.transport = transport;
            timer          = new Timer(GlobalConst.LobbyProtocolPingInterval * 1000);
            timer.Elapsed += TimerOnElapsed;

            transport.ConnectAndRun(OnCommandReceived, OnConnected, OnConnectionClosed);
        }