reads and writes port status