Abstraction and base class for stream-based protocols.
    public abstract class StreamPeer : Reference

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.

Inheritance Chain

Derived Classes

Properties

    public bool BigEndian { get; set; }

If true, this StreamPeer will using big-endian format for encoding and decoding.

Methods

    public int Get16()

Get a signed 16 bit value from the stream.

    public int Get32()

Get a signed 32 bit value from the stream.

    public int Get64()

Get a signed 64 bit value from the stream.

    public int Get8()

Get a signed byte from the stream.

    public int GetAvailableBytes()

Return the amount of bytes this StreamPeer has available.

    public Godot.Collections.Array GetData(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.

    public float GetDouble()

Get a double-precision float from the stream.

    public float GetFloat()

Get a single-precision float from the stream.

    public Godot.Collections.Array GetPartialData(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.

    public string GetString(int bytes = -1)

Get a string with byte-length bytes from the stream. If bytes is negative (default) the length will be read from the stream using the reverse process of PutString(string).

    public int GetU16()

Get an unsigned 16 bit value from the stream.

    public int GetU32()

Get an unsigned 32 bit value from the stream.

    public int GetU64()

Get an unsigned 64 bit value from the stream.

    public int GetU8()

Get an unsigned byte from the stream.

    public string GetUtf8String(int bytes = -1)

Get a utf8 string with byte-length bytes from the stream (this decodes the string sent as utf8). If bytes is negative (default) the length will be read from the stream using the reverse process of PutUtf8String(string).

    public object GetVar()

Get a Variant from the stream.

    public bool IsBigEndianEnabled()

Getter for BigEndian

    public void Put16(int value)

Put a signed 16 bit value into the stream.

    public void Put32(int value)

Put a signed 32 bit value into the stream.

    public void Put64(int value)

Put a signed 64 bit value into the stream.

    public void Put8(int value)

Put a signed byte into the stream.

    public Error PutData(byte[] data)

Send a chunk of data through the connection, blocking if necessary until the data is done sending. This function returns an Error code.

    public void PutDouble(float value)

Put a double-precision float into the stream.

    public void PutFloat(float value)

Put a single-precision float into the stream.

    public Godot.Collections.Array PutPartialData(byte[] 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.

    public void PutString(string value)

Put a zero-terminated ascii string into the stream prepended by a 32 bits unsigned integer representing its size.

    public void PutU16(int value)

Put an unsigned 16 bit value into the stream.

    public void PutU32(int value)

Put an unsigned 32 bit value into the stream.

    public void PutU64(int value)

Put an unsigned 64 bit value into the stream.

    public void PutU8(int value)

Put an unsigned byte into the stream.

    public void PutUtf8String(string value)

Put a zero-terminated utf8 string into the stream prepended by a 32 bits unsigned integer representing its size.

    public void PutVar(object value)

Put a Variant into the stream.

    public void SetBigEndian(bool enable)

Setter for BigEndian

Tags: