3.5.5.1.1.2 When ConnectionState is Established (Receiving Application Data)

The client validates the Polling-POST-Response message, as specified in section 2.2.4.2, as follows:

1. The client MUST validate the Polling-Virtual-Connection-Message, as specified in section 2.2.4.1.3, and extract the version, server name, virtual connection GUID, sequence number, and checksum. If parsing fails, it is a protocol error and the client MUST close the connections, as specified in section 3.5.4.2.

2. The client SHOULD<46> check the Polling-Encapsulation-Version and, if the version does not equal the required value (see section 2.2.4.1.3.1.1), close the polling virtual connection, as specified in section 3.5.4.2.

3. The client SHOULD<47> verify that the Relay-Server-URL in the message equals its own name and, if the names are not equal. close the virtual connection, as specified in section 3.5.4.2.

4. The client MUST examine the Virtual-Connection-GUID to validate that it is found in the VirtualConnectionGUIDList. Otherwise it is a protocol error and the client MUST close the polling connection, as specified in section 3.5.4.2.

5. The value of Sequence-Number MUST be verified and stored in ResponseSequenceNum.

6. The received sequence number MUST be equal to the value stored in the ResponseSequenceNum plus 1. Verification failure results in polling virtual connection closure, as specified in section 3.5.4.2.

7. The Checksum field MUST be calculated with the application data and verified as specified in section 2.2.4.1.3.1.3. The Checksum value is calculated only in the presence of application data and does not include the Polling-Virtual-Connection-Request-Messages. If there is no application data, the Checksum field MUST be zero ("0").

If Polling-Content-Length is greater than the length of Polling-Virtual-Connection-Message plus the length of Polling-Virtual-Connection-Response-Message, there is application data. Otherwise, the Polling-POST-Response message contains no application data.

Any verification failure results in polling virtual connection closure, as specified in section 3.5.4.2.

The clients sets the ClientOKtoSend state variable to "true".

The Polling timer MUST be started if there is no data to be sent now.

The client MUST refresh PollingMinRepetitionInterval, PollingMinRepetitionInterval, and PollingRepetitionCount values, if they have changed, with the contents of the Polling-Virtual-Connection-Response-Message.

The application data is passed to the application layer to be processed and consumed.

The client MUST close the POST session, as specified in section 3.5.5.1.5.

If there is buffered data, the client MUST send the data as specified in section 3.5.4.3.