Compartir a través de


3.3.5.25 Receiving an SMB_COM_READ_MPX Request

CIFS permits the use of the SMB_COM_READ_MPX (section 2.2.4.23) command over connectionless transports only. SMB message signing is not supported over connectionless transports.

Upon receiving an SMB_COM_READ_MPX Request (section 2.2.4.23.1), the server MUST validate the FID and UID to ensure that the client has sufficient privilege to read the file. If no errors occur, the server MUST then attempt to read from the underlying object store for the file indicated by the FID of the request.<277>

As is true in SMB_COM_READ, the total number of bytes returned can be less than the number requested only if a read specifies bytes beyond the current file size, and FID refers to a disk file. In this case, the server MUST return only the bytes that exist. A read that begins at or beyond the end of file MUST result in a single response with a zero value in Count. If the total number of bytes returned is less than the number of bytes requested, this indicates end of file (if reading other than a standard blocked disk file, only zero bytes returned indicates end of file).

Once started, the Read Block Multiplexed operation MUST run to completion. The client MUST receive all of the responses generated by the server. Conflicting commands (such as file close) MUST NOT be sent to the server while a multiplexed operation is in progress.

Server support of this command is optional.<278>

If the read request was made to a named pipe or I/O device, the following additional rules apply:

  • If the Timeout value is -1 (0xFFFFFFFF, "wait forever") or the server does not implement Timeout processing,<279> the server SHOULD wait until there are at least MinCountOfBytesToReturn bytes of data read from the device before returning a response to the client.

  • If the Timeout value is -2 (0xFFFFFFFE, "default"), the server SHOULD wait for the default time-out associated with the named pipe or I/O device.

  • If the Timeout value is zero and no data is currently available, the server SHOULD send a successful response with the DataLength field set to zero.

  • Otherwise, the server SHOULD wait to send the response until either MinCountOfBytesToReturn or more bytes of data become available or the Timeout in milliseconds elapses. If Timeout elapses before MinCountOfBytesToReturn bytes are read, the server SHOULD send a response with an error status indicating that the Timeout occurred and SHOULD also respond with any bytes already read.

If an error is detected, the server MUST send a single error response message to the client. Otherwise, the server MUST respond to the request with one or more SMB_COM_READ_MPX response messages (constructed as specified in section 2.2.4.23.2) until the requested amount of data has been returned or an error occurs. Each server response MUST contain the PID and MID of the original client request, as well as the Offset and Count describing the returned data. The client has received all of the data bytes when the sum of the DataLength fields received in each response equals the total amount of data bytes expected (smallest Count received). This allows the protocol to work even if the responses are received out of sequence.

The response MUST be sent to the client as described in section 3.3.4.1, with the exception that SMB signing and connectionless protocols are mutually exclusive.