read binary data from a network connection
rtable with hardware datatype
valid open socket ID
Because Maple strings are incapable of encoding binary data (containing null bytes), an interface different from Sockets[Read] is required for applications that need to be able to transmit such data. This is achieved by using procedure ReadBinary.
The first argument a to procedure ReadBinary must be a hardware rtable; that is, one whose datatype is one of the following:
integer[ 1 ]
integer[ 2 ]
integer[ 4 ]
integer[ 8 ]
float[ 4 ]
float[ 8 ]
The rtable a should not use any indexing functions and the storage parameter should not be set to anything other than rectangular.
If the datatype is anything other than integer, then the data to be read is treated as structured according to the indicated datatype and each ``record'' is converted to the host byte order. For example, passing an rtable whose datatype is float causes each four-byte float to be converted from Network Byte Order to Host Byte Order.
ReadBinary accepts a socket ID sid as its second argument. Parameter sid indicates the network connection from which to read the data.
ReadBinary attempts to read as much data from the socket connection as it can, up to the total amount of space available in the rtable a. The number of bytes actually read is returned.
Note: There may be more data available on the socket than can be accommodated in the rtable passed to ReadBinary. Once the rtable has been filled, ReadBinary returns, leaving any unread data on the socket for subsequent calls to consume.
It is also possible that there is insufficient data available on the socket to fill rtable a.
The time service (RFC 868) delivers the current time (measured as the number of seconds since 00:00 (midnight) 01 January 1900) as a 32-bit integer in Network Byte Order.
Download Help Document
What kind of issue would you like to report? (Optional)