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); }
private void SendBase(HolePunchingType type, byte[] content = null) { var qm = PSocketMsg.Parse(content, type); SendAsync(qm.ToBytes()); }