Read From a File 0x2222 72

Reads a block of bytes from a file starting at a specified file offset.

NetWare Servers:2.x, 3.x, 4.x, 5.x

Request Format

Offset

Content

Type

Request header

6

FunctionCode (72)

byte

7

Reserved

byte

8

FileHandle

byte[6] (Hi-Lo)

14

StartingByteOffset

long (Hi-Lo)

18

BytesToRead

word (Hi-Lo)

Reply Format

Offset

Content

Type

Reply header

8

BytesActuallyRead

word (Hi-Lo)

10

Data

byte[BytesActuallyRead]

Return Values

Decimal

Hex

Description

0

0x00

Successful

131

0x83

Hard I/O Error

136

0x88

Invalid File Handle

147

0x93

No Read Privileges

255

0xFF

I/O Bound Error

Remarks

If the EOF is encountered before the read request is satisfied, the server returns Successful, but BytesActuallyRead will contain a count less than BytesToRead.

If the calling client does not have read access privileges to the indicated file, or if a portion of the targeted byte block is locked for use by some other client, Read From a File will fail.

Clients are constrained by the current negotiated file buffer size (see Negotiate Buffer Size 0x2222 33). A client cannot request more bytes of data than will fit in the currently negotiated buffer size.

For NetWare versions prior to 5.0, the client cannot request a data block that straddles a buffer-size boundary in the file. For example, if the current buffer size were 512 bytes and the client wants to read 1000 bytes starting at file offset 500, the client must issue three read requests. The first request will read 12 bytes starting at offset 500. The second request will read 512 bytes starting at offset 512. The last request will read 476 bytes starting at offset 1024.

For NetWare 5.0 and later, the client can request a data block that straddles a buffer-size boundary in the file. However, the client is still constrained by the current negotiated file buffer size, and thus cannot request more bytes of data than will fit in the currently negotiated buffer size.

If a client requests a block of data that starts on an odd-byte boundary within the file, the first byte of the data field returned by the server will contain garbage. The actual data from the file will start in the second byte of the data block.

FileHandle requires the left most or most significant 4 bytes in Hi-Lo order.