Exemplo n.º 1
0
        /// <summary>
        /// 对数据的打包处理
        /// </summary>
        private void DealEventPool()
        {
            while (true)
            {
                SocketEventParam param = _socketEventPool.GetObj();
                if (param == null)
                {
                    break;
                }

                if (param.SocketEvent == EN_SocketEvent.close)
                {
                    var aa = _clientGroup.TryRemove(param.Socket, out _);
                    if (!aa)
                    {
                        Console.WriteLine("_clientGroup TryRemove False");
                    }
                }

                //if (PacketMinLen == 0) //字节流处理
                //{
                OnSocketPacketEvent?.Invoke(param);
                //}
            }
        }
Exemplo n.º 2
0
 /// <summary>
 /// package中添加的事件方法
 /// </summary>
 /// <param name="param"></param>
 public void PutClientPacket(SocketEventParam param)
 {
     OnSocketPacketEvent?.Invoke(param);
 }