Ejemplo n.º 1
0
 public void Send(YChannel chanael, IPacket pack)
 {
     if (chanael == null)
     {
         OnRaiseError("通道不能为空");
         return;
     }
     chanael.Send(pack.Encoder());
 }
Ejemplo n.º 2
0
 /// <summary>
 /// 发送一条数据包
 /// </summary>
 /// <param name="pack"></param>
 public virtual void Send(IPacket pack)
 {
     if (isInit == false)
     {
         OnRaiseError("未初始化,请先初始化");
         return;
     }
     if (pack is MessagePack)
     {
         MessagePack mp = pack as MessagePack;
         if (string.IsNullOrWhiteSpace(mp.FromId))
         {
             mp.FromId = this.Id;
         }
     }
     //if(string.IsNullOrWhiteSpace(pack.FromId))
     //{
     //    pack.FromId = this.Id;
     //}
     this.parentSocket.Send(pack.Encoder());
 }