/// <summary> /// 接收信息包 /// </summary> /// <param name="pb"></param> public override void Receive(PacketBase pb) { if (this.m_cDispatch != null) { this.m_cDispatch.AckPacket(pb); } }
/// <summary> /// 发送数据 /// </summary> /// <param name="pb"></param> public override void Send(PacketBase pb) { DummyAcceptManager.GetInstance().Send(this, this.m_iPort, pb); }
/// <summary> /// 发送 /// </summary> /// <param name="pb"></param> public override void Send(PacketBase pb) { try { if (pb != null) { this.m_cSendQueue.Enqueue(pb); } } catch (Exception e) { WriteFiles.WritFile.Log(LogerType.ERROR, e.ToString()); DisConnect(); } }
/// <summary> /// 发送数据 /// </summary> /// <param name="define"></param> /// <param name="pb"></param> public void Send(int define, PacketBase pb) { if (this.m_vecSession.Length <= define) { //Error return; } if (this.m_vecSession[define] == null) { //Error return; } if (this.m_vecSession[define].GetStatus() != SESSION_STATUS.CONNECT_SUCCESS) { //Error return; } this.m_vecSession[define].Send(pb); }
/// <summary> /// 接受消息 /// </summary> /// <param name="pb"></param> public virtual bool AckPacket(PacketBase pb) { this.m_cReceiveQueue.Enqueue(pb); return true; }
/// <summary> /// 发送数据包 /// </summary> /// <param name="pb"></param> public override void Send(PacketBase pb) { try { if (pb != null) { this.m_cSendQueue.Enqueue(pb); } } catch (Exception e) { WriteFiles.WritFile.Log(LogerType.ERROR, e.StackTrace); DisConnect(); if (this.m_iReConnectSecond >= 0) //设置重连 { this.m_bStartReConnect = true; this.m_lStartReConnectTime = DateTime.Now.Ticks; } } }
public NetMessage(PacketBase packet) : this(packet, null) { }
/// <summary> /// Sends raw data to the given client by serializing the packet. /// This function uses the reliable channel. /// </summary> /// <param name="client">receiver</param> /// <param name="packet">data to be sent</param> private void Send(NetPeer client, PacketBase packet) { writer.Reset(); packet.Serialize(writer); client.Send(writer, SendOptions.ReliableOrdered); }
public NetMessage(PacketBase packet, NetPeer client) { this.packet = packet; this.client = client; }
/// <summary> /// 接受消息 /// </summary> /// <param name="pb"></param> public virtual bool AckPacket(PacketBase pb) { this.m_cReceiveQueue.Enqueue(pb); return(true); }
/// <summary> /// Adds a new message to be sent. /// </summary> /// <param name="packet">Message to send</param> public void AddOutputMessage(PacketBase packet) { lock (outputLock) { this.outputMessages.Enqueue(packet); } }
/// <summary> /// 发送数据 /// </summary> /// <param name="session"></param> /// <param name="port"></param> /// <returns></returns> public bool Send(IDummySession session, int port, PacketBase pb) { if (this.m_mapAccept.ContainsKey(port)) { this.m_mapAccept[port].Receive(session, pb); return true; } return false; }