3.2.4.1.6 Algorithm for Handling Available Message Sequence Numbers by the Client

The client MUST implement an algorithm to manage message sequence numbers. Sequence numbers are used to associate requests with responses and to determine what requests are allowed for processing. The algorithm MUST meet the following conditions:

  • When the connection is first established, the allowable sequence numbers for sending a request MUST be set to the set { 0 }.

  • The client MUST never send a request on a given connection with a sequence number that has already been used unless it is a request to cancel a previously sent request.

  • The client MUST grow the set in a monotonically increasing manner based on the credits granted. If the set is { 0 }, and 2 credits are granted, the set MUST grow to { 0, 1, 2 }.

  • The client MUST use the lowest available sequence number in its allowable set for each request.

  • For a multi-credit request as specified in section 3.2.4.1.5, the client MUST use the lowest available range of consecutive sequence numbers.

  • If an SMB2 CANCEL Request is sent, the client MUST NOT consume a sequence number. Otherwise, the client MUST consume a sequence number, or range of consecutive sequence numbers, when it sends out an SMB2 request.

For the server side of this algorithm, see section 3.3.1.1.