/// <summary> /// Creates a Radius response datagram packet from a RadiusPacket to be send. /// @param packet RadiusPacket /// @param secret shared secret to encode packet /// @param request request packet /// @return new datagram packet /// @throws IOException /// </summary> protected Byte[] MakeDatagramPacket(RadiusPacket packet, String secret, RadiusPacket request) { var bos = new MemoryStream(); try { packet.EncodeResponsePacket(bos, secret, request); return(bos.ToArray()); } finally { bos.Close(); bos.Dispose(); } }