Beispiel #1
0
        public static void CreateServer(string name, PType type, int maxClient)
        {
            if (SERVERS.ContainsKey(name))
            {
                Logger.Warn($"Server [{name}] already exist");
                return;
            }
            INetServer server = null;

            switch (type)
            {
            case PType.Tcp:
                server = new TCPServer(maxClient);
                break;

            case PType.Kcp:
                server = new KCPServer(maxClient);
                break;
            }
            SERVERS[name] = server;
        }
Beispiel #2
0
 public KCPUserToken Pop(KCPServer server)
 {
     return(this._pool.Count == 0 ? new KCPUserToken(server, ( ushort )Interlocked.Increment(ref _currId)) : this._pool.Dequeue());
 }
Beispiel #3
0
 internal KCPUserToken(KCPServer server, ushort id)
 {
     this.id        = id;
     this._server   = server;
     this._kcpProxy = new KCPProxy(this.id, this.OnKCPOutout, (log, user) => /* Logger.Net( $"KCP log:{log}" )*/ { });
 }