forked from godotengine/godot
-
Notifications
You must be signed in to change notification settings - Fork 20
class_streampeer
reduz edited this page Feb 23, 2014
·
9 revisions
Inherits: Reference\n\n### Brief Description
Abstraction and base class for stream-based protocols.
- int put_data" ( RawArray data )
- Array put_partial_data" ( RawArray data )
- Array get_data" ( int bytes )
- Array get_partial_data" ( int bytes )
StreamPeer is an abstration 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.
== put_data ==
- int put_data" ( RawArray data ) \ Send a chunk of data through the connection, blocking if necesary until the data is done sending. This function returns an [Error] code. == put_partial_data ==
- Array put_partial_data" ( RawArray 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. == get_data ==
- Array get_data" ( 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. == get_partial_data ==
- Array get_partial_data" ( 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.