3.2.5 Message Processing Events and Sequencing Rules
The processing of messages received from a TDS 4.2 server depends on the message type and the state the TDS 4.2 client is in. The message type is determined from the TDS 4.2 packet type and the token stream inside the TDS 4.2 packet payload, as described in section 2.2.3. The rest of this section describes message processing and actions that can be taken on messages.
When the TDS 4.2 client enters either the Logged In state or the final state, it MUST stop the Connection Timer (if implemented and running), the Client Request Timer (if implemented and running), and the Cancel Timer (if implemented and running).
When a TDS 4.2 client receives a structurally invalid TDS 4.2 message, it MUST close the underlying transport connection, indicate an error to the upper layer, and enter the final state.
When a TDS 4.2 client receives a table response (TDS 4.2 packet type %x04) from the server, it MUST behave as follows, according to the state of the TDS 4.2 client.