pub fn write_packet<W>(stream: W, packet: &Packet) -> Result<(), Error>where W: Write,
Write a packet to a stream