.. Generated automatically by doc/tools/makerst.py in Godot's source tree. .. DO NOT EDIT THIS FILE, but the doc/base/classes.xml source instead. .. _class_StreamPeer: StreamPeer ========== **Inherits:** :ref:`Reference` **<** :ref:`Object` **Inherited By:** :ref:`StreamPeerBuffer`, :ref:`StreamPeerSSL`, :ref:`StreamPeerTCP` **Category:** Core Brief Description ----------------- Abstraction and base class for stream-based protocols. Member Functions ---------------- +--------------------------------+-------------------------------------------------------------------------------------------------------------------------+ | :ref:`int` | :ref:`get_16` **(** **)** | +--------------------------------+-------------------------------------------------------------------------------------------------------------------------+ | :ref:`int` | :ref:`get_32` **(** **)** | +--------------------------------+-------------------------------------------------------------------------------------------------------------------------+ | :ref:`int` | :ref:`get_64` **(** **)** | +--------------------------------+-------------------------------------------------------------------------------------------------------------------------+ | :ref:`int` | :ref:`get_8` **(** **)** | +--------------------------------+-------------------------------------------------------------------------------------------------------------------------+ | :ref:`int` | :ref:`get_available_bytes` **(** **)** const | +--------------------------------+-------------------------------------------------------------------------------------------------------------------------+ | :ref:`Array` | :ref:`get_data` **(** :ref:`int` bytes **)** | +--------------------------------+-------------------------------------------------------------------------------------------------------------------------+ | :ref:`float` | :ref:`get_double` **(** **)** | +--------------------------------+-------------------------------------------------------------------------------------------------------------------------+ | :ref:`float` | :ref:`get_float` **(** **)** | +--------------------------------+-------------------------------------------------------------------------------------------------------------------------+ | :ref:`Array` | :ref:`get_partial_data` **(** :ref:`int` bytes **)** | +--------------------------------+-------------------------------------------------------------------------------------------------------------------------+ | :ref:`String` | :ref:`get_string` **(** :ref:`int` bytes **)** | +--------------------------------+-------------------------------------------------------------------------------------------------------------------------+ | :ref:`int` | :ref:`get_u16` **(** **)** | +--------------------------------+-------------------------------------------------------------------------------------------------------------------------+ | :ref:`int` | :ref:`get_u32` **(** **)** | +--------------------------------+-------------------------------------------------------------------------------------------------------------------------+ | :ref:`int` | :ref:`get_u64` **(** **)** | +--------------------------------+-------------------------------------------------------------------------------------------------------------------------+ | :ref:`int` | :ref:`get_u8` **(** **)** | +--------------------------------+-------------------------------------------------------------------------------------------------------------------------+ | :ref:`String` | :ref:`get_utf8_string` **(** :ref:`int` bytes **)** | +--------------------------------+-------------------------------------------------------------------------------------------------------------------------+ | :ref:`Variant` | :ref:`get_var` **(** **)** | +--------------------------------+-------------------------------------------------------------------------------------------------------------------------+ | :ref:`bool` | :ref:`is_big_endian_enabled` **(** **)** const | +--------------------------------+-------------------------------------------------------------------------------------------------------------------------+ | void | :ref:`put_16` **(** :ref:`int` val **)** | +--------------------------------+-------------------------------------------------------------------------------------------------------------------------+ | void | :ref:`put_32` **(** :ref:`int` val **)** | +--------------------------------+-------------------------------------------------------------------------------------------------------------------------+ | void | :ref:`put_64` **(** :ref:`int` val **)** | +--------------------------------+-------------------------------------------------------------------------------------------------------------------------+ | void | :ref:`put_8` **(** :ref:`int` val **)** | +--------------------------------+-------------------------------------------------------------------------------------------------------------------------+ | :ref:`int` | :ref:`put_data` **(** :ref:`PoolByteArray` data **)** | +--------------------------------+-------------------------------------------------------------------------------------------------------------------------+ | void | :ref:`put_double` **(** :ref:`float` val **)** | +--------------------------------+-------------------------------------------------------------------------------------------------------------------------+ | void | :ref:`put_float` **(** :ref:`float` val **)** | +--------------------------------+-------------------------------------------------------------------------------------------------------------------------+ | :ref:`Array` | :ref:`put_partial_data` **(** :ref:`PoolByteArray` data **)** | +--------------------------------+-------------------------------------------------------------------------------------------------------------------------+ | void | :ref:`put_u16` **(** :ref:`int` val **)** | +--------------------------------+-------------------------------------------------------------------------------------------------------------------------+ | void | :ref:`put_u32` **(** :ref:`int` val **)** | +--------------------------------+-------------------------------------------------------------------------------------------------------------------------+ | void | :ref:`put_u64` **(** :ref:`int` val **)** | +--------------------------------+-------------------------------------------------------------------------------------------------------------------------+ | void | :ref:`put_u8` **(** :ref:`int` val **)** | +--------------------------------+-------------------------------------------------------------------------------------------------------------------------+ | void | :ref:`put_utf8_string` **(** :ref:`String` val **)** | +--------------------------------+-------------------------------------------------------------------------------------------------------------------------+ | void | :ref:`put_var` **(** :ref:`Variant` val **)** | +--------------------------------+-------------------------------------------------------------------------------------------------------------------------+ | void | :ref:`set_big_endian` **(** :ref:`bool` enable **)** | +--------------------------------+-------------------------------------------------------------------------------------------------------------------------+ 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. Member Function Description --------------------------- .. _class_StreamPeer_get_16: - :ref:`int` **get_16** **(** **)** Get a signed 16 bit value from the stream. .. _class_StreamPeer_get_32: - :ref:`int` **get_32** **(** **)** Get a signed 32 bit value from the stream. .. _class_StreamPeer_get_64: - :ref:`int` **get_64** **(** **)** Get a signed 64 bit value from the stream. .. _class_StreamPeer_get_8: - :ref:`int` **get_8** **(** **)** Get a signed byte from the stream. .. _class_StreamPeer_get_available_bytes: - :ref:`int` **get_available_bytes** **(** **)** const Return the amount of bytes this :ref:`StreamPeer` has available. .. _class_StreamPeer_get_data: - :ref:`Array` **get_data** **(** :ref:`int` bytes **)** 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. .. _class_StreamPeer_get_double: - :ref:`float` **get_double** **(** **)** Get a double-precision float from the stream. .. _class_StreamPeer_get_float: - :ref:`float` **get_float** **(** **)** Get a single-precision float from the stream. .. _class_StreamPeer_get_partial_data: - :ref:`Array` **get_partial_data** **(** :ref:`int` bytes **)** 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. .. _class_StreamPeer_get_string: - :ref:`String` **get_string** **(** :ref:`int` bytes **)** Get a string with byte-length "bytes" from the stream. .. _class_StreamPeer_get_u16: - :ref:`int` **get_u16** **(** **)** Get an unsigned 16 bit value from the stream. .. _class_StreamPeer_get_u32: - :ref:`int` **get_u32** **(** **)** Get an unsigned 32 bit value from the stream. .. _class_StreamPeer_get_u64: - :ref:`int` **get_u64** **(** **)** Get an unsigned 16 bit value from the stream. .. _class_StreamPeer_get_u8: - :ref:`int` **get_u8** **(** **)** Get an unsigned byte from the stream. .. _class_StreamPeer_get_utf8_string: - :ref:`String` **get_utf8_string** **(** :ref:`int` bytes **)** Get a utf8 string with byte-length "bytes" from the stream (this decodes the string sent as utf8). .. _class_StreamPeer_get_var: - :ref:`Variant` **get_var** **(** **)** Get a Variant from the stream. .. _class_StreamPeer_is_big_endian_enabled: - :ref:`bool` **is_big_endian_enabled** **(** **)** const Return whether this :ref:`StreamPeer` is using big-endian format. .. _class_StreamPeer_put_16: - void **put_16** **(** :ref:`int` val **)** Put a signed 16 bit value into the stream. .. _class_StreamPeer_put_32: - void **put_32** **(** :ref:`int` val **)** Put a signed 32 bit value into the stream. .. _class_StreamPeer_put_64: - void **put_64** **(** :ref:`int` val **)** Put a signed 64 bit value into the stream. .. _class_StreamPeer_put_8: - void **put_8** **(** :ref:`int` val **)** Put a signed byte into the stream. .. _class_StreamPeer_put_data: - :ref:`int` **put_data** **(** :ref:`PoolByteArray` data **)** Send a chunk of data through the connection, blocking if necessary until the data is done sending. This function returns an Error code. .. _class_StreamPeer_put_double: - void **put_double** **(** :ref:`float` val **)** Put a double-precision float into the stream. .. _class_StreamPeer_put_float: - void **put_float** **(** :ref:`float` val **)** Put a single-precision float into the stream. .. _class_StreamPeer_put_partial_data: - :ref:`Array` **put_partial_data** **(** :ref:`PoolByteArray` data **)** 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. .. _class_StreamPeer_put_u16: - void **put_u16** **(** :ref:`int` val **)** Put an unsigned 16 bit value into the stream. .. _class_StreamPeer_put_u32: - void **put_u32** **(** :ref:`int` val **)** Put an unsigned 32 bit value into the stream. .. _class_StreamPeer_put_u64: - void **put_u64** **(** :ref:`int` val **)** Put an unsigned 64 bit value into the stream. .. _class_StreamPeer_put_u8: - void **put_u8** **(** :ref:`int` val **)** Put an unsigned byte into the stream. .. _class_StreamPeer_put_utf8_string: - void **put_utf8_string** **(** :ref:`String` val **)** Put a zero-terminated utf8 string into the stream. .. _class_StreamPeer_put_var: - void **put_var** **(** :ref:`Variant` val **)** Put a Variant into the stream. .. _class_StreamPeer_set_big_endian: - void **set_big_endian** **(** :ref:`bool` enable **)** Set this :ref:`StreamPeer` to use big-endian format. Default is false.