PacketPeer
Inherited By: , PacketPeerGDNative, , PacketPeerUDP,
Category: Core
Abstraction and base class for packet-based protocols.
Properties
Description
PacketPeer is an abstraction and base class for packet-based protocols (such as UDP). It provides an API for sending and receiving packets both as raw data or variables. This makes it easy to transfer data over a protocol, without having to encode data as low level bytes or having to worry about network ordering.
- bool allow_object_decoding
If the PacketPeer will allow encoding and decoding of object via and put_var.
WARNING: Deserialized object can contain code which gets executed. Do not use this option if the serialized object comes from untrusted sources to avoid potential security threats (remote code execution).
Method Descriptions
Returns the number of packets currently available in the ring-buffer.
- get_packet ( )
Get a raw packet.
- Error get_packet_error ( ) const
- get_var ( bool allow_objects=false )
Get a Variant. When allow_objects
(or ) is decoding objects is allowed.
WARNING: Deserialized object can contain code which gets executed. Do not use this option if the serialized object comes from untrusted sources to avoid potential security threats (remote code execution).
Send a raw packet.
Send a Variant as a packet. When full_objects
(or ) is encoding objects is allowed (and can potentially include code).