Subject: Use of the PKT_ packet type definitions (This message is being sent to all CPSC 360 students) I have seen some students attempt to use 90 #define PKT_CONNECT 0 91 #define PKT_CONNACK 1 92 #define PKT_DATA 2 // or ACK 93 #define PKT_CLOSE 3 94 #define PKT_CLOSEACK 4 95 #define PKT_RESET 5 96 #define PKT_TYPES (PKT_RESET+1) in an incorrect way. The common error is to compare them directly to hdr->flags as in: if (hdr->flags == PKT_CONNECT) do something This can't possibly work!!!! In a proper connect packet hdr->flags == 1 . In a proper connack packet hdr->flags == 3!!! If you want to use the PKT_ defines you MUST build a helper routine that maps flag settings to PKT_ values: pkt = rps_packet_type(hdr->flags); if (pkt == PKT_CONNECT) do_something The only USEFUL reason for using the PKT values is if you use the table driven state machine (described in the multicolored tables in the notes) to drive your receive logic. If you are not doing that you should work directly with the RPH values as in if (hdr->flags == (RPH_CONNECT | RPH_ACK)) dprintf("this is a connack packet \n");