Abstraction and base class for stream-based protocols.
</brief_description>
<description>
StreamPeer is an abstraction and base class for stream-based protocols (such as TCP or Unix Sockets). It provides an API for sending and receiving data through streams as raw data or strings.
Return a chunk data with the received bytes. The amount of bytes to be received can be requested in the "bytes" argument. If not enough bytes are available, the function will block until the desired amount is received. This function returns two values, an Error code and a data array.
</description>
</method>
<methodname="get_double">
<returntype="float">
</return>
<description>
Get a double-precision float from the stream.
</description>
</method>
<methodname="get_float">
<returntype="float">
</return>
<description>
Get a single-precision float from the stream.
</description>
</method>
<methodname="get_partial_data">
<returntype="Array">
</return>
<argumentindex="0"name="bytes"type="int">
</argument>
<description>
Return a chunk data with the received bytes. The amount of bytes to be received can be requested in the "bytes" argument. If not enough bytes are available, the function will return how many were actually received. This function returns two values, an Error code, and a data array.
</description>
</method>
<methodname="get_string">
<returntype="String">
</return>
<argumentindex="0"name="bytes"type="int">
</argument>
<description>
Get a string with byte-length "bytes" from the stream.
Send a chunk of data through the connection, if all the data could not be sent at once, only part of it will. This function returns two values, an Error code and an integer, describing how much data was actually sent.
</description>
</method>
<methodname="put_u16">
<returntype="void">
</return>
<argumentindex="0"name="val"type="int">
</argument>
<description>
Put an unsigned 16 bit value into the stream.
</description>
</method>
<methodname="put_u32">
<returntype="void">
</return>
<argumentindex="0"name="val"type="int">
</argument>
<description>
Put an unsigned 32 bit value into the stream.
</description>
</method>
<methodname="put_u64">
<returntype="void">
</return>
<argumentindex="0"name="val"type="int">
</argument>
<description>
Put an unsigned 64 bit value into the stream.
</description>
</method>
<methodname="put_u8">
<returntype="void">
</return>
<argumentindex="0"name="val"type="int">
</argument>
<description>
Put an unsigned byte into the stream.
</description>
</method>
<methodname="put_utf8_string">
<returntype="void">
</return>
<argumentindex="0"name="val"type="String">
</argument>
<description>
Put a zero-terminated utf8 string into the stream.