Use i/o streams for packet writing