Up to date

This page is up to date for Godot 4.2. If you still find outdated information, please open an issue.

StreamPeer

Inherits: RefCounted < Object

Inherited By: StreamPeerBuffer, StreamPeerExtension, StreamPeerGZIP, StreamPeerTCP, StreamPeerTLS

Abstract base class for interacting with streams.

Description

StreamPeer is an abstract base class mostly used for stream-based protocols (such as TCP). It provides an API for sending and receiving data through streams as raw data or strings.

Note: When exporting to Android, make sure to enable the INTERNET permission in the Android export preset before exporting the project or using one-click deploy. Otherwise, network communication of any kind will be blocked by Android.

Properties

bool

big_endian

false

Methods

int

get_8 ( )

int

get_16 ( )

int

get_32 ( )

int

get_64 ( )

int

get_available_bytes ( ) const

Array

get_data ( int bytes )

float

get_double ( )

float

get_float ( )

Array

get_partial_data ( int bytes )

String

get_string ( int bytes=-1 )

int

get_u8 ( )

int

get_u16 ( )

int

get_u32 ( )

int

get_u64 ( )

String

get_utf8_string ( int bytes=-1 )

Variant

get_var ( bool allow_objects=false )

void

put_8 ( int value )

void

put_16 ( int value )

void

put_32 ( int value )

void

put_64 ( int value )

Error

put_data ( PackedByteArray data )

void

put_double ( float value )

void

put_float ( float value )

Array

put_partial_data ( PackedByteArray data )

void

put_string ( String value )

void

put_u8 ( int value )

void

put_u16 ( int value )

void

put_u32 ( int value )

void

put_u64 ( int value )

void

put_utf8_string ( String value )

void

put_var ( Variant value, bool full_objects=false )


Property Descriptions

bool big_endian = false

  • void set_big_endian