public void Send(YChannel chanael, IPacket pack) { if (chanael == null) { OnRaiseError("通道不能为空"); return; } chanael.Send(pack.Encoder()); }
/// <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()); }