/// <summary> /// Initializes a new instance of the <see cref="UdpPacket"/> class, with /// no payload. /// /// Header must be populated manually. /// </summary> /// <param name="type">The type.</param> public UdpPacket(EUdpPacketType type) { this.Header = new UdpHeader(); this.Payload = new MemoryStream(); this.Header.PacketType = type; }
/// <summary> /// Initializes a new instance of the <see cref="UdpPacket"/> class, of the /// specified type containing the first 'length' bytes of specified payload. /// /// Header must be populated manually. /// </summary> /// <param name="type">The type.</param> /// <param name="payload">The payload.</param> /// <param name="length">The length.</param> public UdpPacket(EUdpPacketType type, MemoryStream payload, long length) : this(type) { SetPayload(payload, length); }
/// <summary> /// Initializes a new instance of the <see cref="UdpPacket"/> class, of the /// specified type containing the specified payload. /// /// Header must be populated manually. /// </summary> /// <param name="type">The type.</param> /// <param name="payload">The payload.</param> public UdpPacket(EUdpPacketType type, MemoryStream payload) : this(type) { SetPayload(payload); }