Michael Piepers homepage | |||||
BeOS Programs | |||||
PalmBeach | |||||
PSION Link Protocol description | |||||
RFSV Protocol description |
The command FREAD used around data from a file opened before to read. It must be used for the same File handle as with the instruction FOPEN one returned the delivery.
Max. number of requested bytes is supplied. If the file is smaller, than the number of requested data, then only the number of still available data is supplied. If the file pointer is at the end of the file, then with a next read attempt of the errors ERR_FILE_EOF (-33) it returns the delivery.
The internal PSION 3c-protocoll can't send more then 511 Byte in one Command! It isn't recommended to transfer more Bytes, because the needed time is very long. The protocoll builtin in the PSION 3c crashes if you request for more then 511 Bytes!
Since with FREAD very size quantities of data will transfer, it is to be made certain that; a response of several Frames can consist the counter in the PLP protocol is inserted for it which indicates descending the number of blocks still which can be expected (inclusive of the own).
It is to be noted that; all values, which are more greater than 8 bits in reverse order will transfer. The LOW byte sent as the first over the line and only then follows the HIGH byte!
The instruction FREAD is as a consequence built into the PLP:
Header | PLP | RFSV FREAD | Footer | CRC | |||
---|---|---|---|---|---|---|---|
16 10 02 | 32 03 02 01 | Command 04 00 |
Size 04 00 |
File handle 01 00 |
Bytes to read 01 02 |
10 03 | 12 34 |
A valid response takes place with the command RESPONSE and returns the delivery an error code.
Header | PLP | RFSV-RESPONSE | Footer | CRC | |||
---|---|---|---|---|---|---|---|
16 10 02 | 33 02 03 01 | Command 2a 00 |
Size 0c 00 |
Result 00 00 |
Data 01 02 03 04 05... |
10 03 | 12 34 |
The command FREAD consists of 3 information units. These have the following meanings:
Length in byte | possible values | Meaning | |
---|---|---|---|
Command | 2 byte | 00 04 (fixed) | The command identifier has always the same value! |
Size | 2 byte | 00 04 (fixed) | 4 byte in the command is always transmitted. |
File handle | 2 byte | variable | It is too transferred to the File handle, from whose file is to be read. |
Number | 2 byte | variable | Number of bytes, which are to be read. Ability also more its, than are actually available. The bytes are then only supplied, which are contained in the file. |
The command FREAD is answered with RESPONSE. This returns the delivery an error code as result. If 00 00 is returned the delivery, then no error occurred.
Length in byte | possible values | Meaning | |||||||
---|---|---|---|---|---|---|---|---|---|
Command | 2 byte | 00 2a (fixed) | The command identifier has always the same value! | ||||||
Size | 2 byte | variable | This value depends on the size of the supplied data. | ||||||
Result | 2 byte | variable | The result can obtain the following values:
|
||||||
Data | variable | variable | Here follow the data, which are to be written. The number can be determined from the field size. |
Michael Piepers homepage | |||||
BeOS Programs | |||||
PalmBeach | |||||
PSION Link Protocol description | |||||
RFSV Protocol description |