Ejemplo n.º 1
0
 public XStream BeginSend(int ptID)
 {
     if (m_sendStream == null)
     {
         m_sendStream = XSocketMgr.Instance.GetXStream();
     }
     m_sendStream.Reset();
     m_sendStream.WriteInt(ptID);
     return(m_sendStream);
 }
Ejemplo n.º 2
0
        private void OnEndRecvStream(IAsyncResult ar)
        {
            try
            {
                int length = m_socket.EndReceive(ar);
                m_bReceiving = false;
                if (length == 0)
                {
                    Close();
                    return;
                }

                m_recvStream.Reset();
                m_recvStream.Write(m_recvBuff, 0, length);
                int protoID = m_recvStream.ReadInt();
                XProtocolMgr.Instance.OnProtocol(protoID, m_recvStream);
            }
            catch (Exception exp)
            {
                Console.WriteLine(exp);
                Close();
            }
        }