Esempio n. 1
0
 /// <summary>
 /// 接收信息包
 /// </summary>
 /// <param name="pb"></param>
 public override void Receive(PacketBase pb)
 {
     if (this.m_cDispatch != null)
     {
         this.m_cDispatch.AckPacket(pb);
     }
 }
Esempio n. 2
0
 /// <summary>
 /// 发送数据
 /// </summary>
 /// <param name="pb"></param>
 public override void Send(PacketBase pb)
 {
     DummyAcceptManager.GetInstance().Send(this, this.m_iPort, pb);
 }
Esempio n. 3
0
 /// <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);
        }
Esempio n. 5
0
 /// <summary>
 /// 接受消息
 /// </summary>
 /// <param name="pb"></param>
 public virtual bool AckPacket(PacketBase pb)
 {
     this.m_cReceiveQueue.Enqueue(pb);
     return true;
 }
Esempio n. 6
0
 /// <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;
         }
     }
 }
Esempio n. 7
0
 public NetMessage(PacketBase packet) : this(packet, null)
 {
 }
Esempio n. 8
0
 /// <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);
 }
Esempio n. 9
0
 public NetMessage(PacketBase packet, NetPeer client)
 {
     this.packet = packet;
     this.client = client;
 }
Esempio n. 10
0
 /// <summary>
 /// 接受消息
 /// </summary>
 /// <param name="pb"></param>
 public virtual bool AckPacket(PacketBase pb)
 {
     this.m_cReceiveQueue.Enqueue(pb);
     return(true);
 }
Esempio n. 11
0
 /// <summary>
 /// 发送数据
 /// </summary>
 /// <param name="pb"></param>
 public override void Send(PacketBase pb)
 {
     DummyAcceptManager.GetInstance().Send(this, this.m_iPort, pb);
 }
Esempio n. 12
0
 /// <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);
     }
 }
Esempio n. 13
0
 /// <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;
 }