Example #1
0
        // 初始化
        public NetSocket(ServerTask _serverTaskCtx = null)
        {
            serverTask      = _serverTaskCtx;
            unPackCache.buf = null;
            unPackCache.len = 0;

            if (serverTask == null)
            {
                return;
            }

            Server server = serverTask.GetServer();

            SetDePacketor(server.dePacketor);

            unPackHeadLen = dePacketor.GetPackHeadPreLength();

            UniqueID uniqueID = UniqueID.GetInstance();

            if (server.serverTaskCount > 1)
            {
                id = uniqueID.gen_multi();
            }
            else
            {
                id = uniqueID.gen();
            }
        }
Example #2
0
        public void ResetGenID()
        {
            UniqueID uniqueID = UniqueID.GetInstance();
            Server   server   = GetServer();

            if (server.serverTaskCount > 1)
            {
                id = uniqueID.gen_multi();
            }
            else
            {
                id = uniqueID.gen();
            }
        }