예제 #1
0
        public static PSocketMsg Parse(byte[] data, HolePunchingType type)
        {
            var msg = new PSocketMsg();

            if (data != null)
            {
                msg.BodyLength = data.Length;
            }
            else
            {
                msg.BodyLength = 0;
            }

            msg.Type = (byte)type;

            if (msg.BodyLength > 0)
            {
                msg.Content = data;
            }

            return(msg);
        }
예제 #2
0
        private void SendBase(HolePunchingType type, byte[] content = null)
        {
            var qm = PSocketMsg.Parse(content, type);

            SendAsync(qm.ToBytes());
        }