示例#1
0
    public override void SendRawData(CTSMarker ctsMarker, MsgPrefix msgNote, byte[] protoBytes)
    {
        if (m_LcrsService != null)
        {
            if (msgNote.MsgID == (UInt16)eMsgID.S2C_RadianceStream)
            {
                LCRS.Log("==================================================== Send data with: " + protoBytes.Length);

                if (m_SessionDataBufferMap.ContainsKey(ctsMarker.sessionId) == false)
                {
                    m_SessionDataBufferMap.Add(ctsMarker.sessionId, new AccumDataBuffer(m_LcrsService, ctsMarker.sessionId));
                }

                m_SessionDataBufferMap[ctsMarker.sessionId].PushData(protoBytes);
            }
            else if (((eMsgID)msgNote.MsgID).ToString().Contains("Json"))
            {
                LCRS.Log("==================================================== Send data with: " + protoBytes.Length);

                m_LcrsService.Sessions.SendTo(ctsMarker.sessionId, protoBytes);
            }
            //m_LcrsService.Sessions.SendToAsync(ctsMarker.sessionId, protoBytes, SendAsyncCompleted);

            // Debug: save the file
            //string strSaveFile = Application.dataPath + "/rt_" + System.DateTime.Now.Minute + "_" + System.DateTime.Now.Second + "_web.png";
            //FileStream fs = File.Open(strSaveFile, FileMode.Create);
            //fs.Write(protoBytes, 0, protoBytes.Length);
            //fs.Close();
        }
    }
示例#2
0
 public static void SendRawData(CTSMarker ctsMarker, MsgPrefix msgNote, byte[] protoBytes)
 {
     if (m_Server != null)
     {
         m_Server.SendRawData(ctsMarker, msgNote, protoBytes);
     }
 }
示例#3
0
    public override void SendRawData(CTSMarker ctsMarker, MsgPrefix msgNote, byte[] protoBytes)
    {
        msgNote.msgSize = (ushort)(ctsMarker.tcpSocket.MsgPrefixLength + (protoBytes != null ? protoBytes.Length : 0));

        ctsMarker.tcpSocket.SendData(msgNote, protoBytes);

        LCRS.Log("================================================= Send data to client");
    }
示例#4
0
 public static byte[] PackMsgHeader(MsgPrefix msgNote, byte[] data)
 {
     byte[] header = BitConverter.GetBytes((int)msgNote.MsgID);
     byte[] tmp    = new byte[header.Length + data.Length];
     System.Buffer.BlockCopy(header, 0, tmp, 0, header.Length);
     System.Buffer.BlockCopy(data, 0, tmp, header.Length, data.Length);
     return(tmp);
 }
示例#5
0
 public void HandleReceiveData(TcpSocket <MsgPrefix> tcpSocket, MsgPrefix msgNote, MemoryStream msgStream)
 {
     if (msgNote.MsgID == (ushort)eMsgID.C2S_AttributeStream)
     {
         Launcher.instance.connectionMgr.ProcessAttributeStream(new CTSMarker(tcpSocket, null), msgStream.ToArray());
     }
     else
     {
         // Common message
     }
 }
示例#6
0
 public virtual void SendRawData(CTSMarker ctsMarker, MsgPrefix msgNote, byte[] protoBytes)
 {
 }