Attention: Here be dragons

This is the latest (unstable) version of this documentation, which may document features not available in or compatible with released stable versions of Godot.

ENetPacketPeer

Inherits: PacketPeer < RefCounted < Object

A wrapper class for an ENetPeer.

Description

A PacketPeer implementation representing a peer of an ENetConnection.

This class cannot be instantiated directly but can be retrieved during ENetConnection.service or via ENetConnection.get_peers.

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.

Tutorials

Methods

int

get_channels ( ) const

String

get_remote_address ( ) const

int

get_remote_port ( ) const

PeerState

get_state ( ) const

float

get_statistic ( PeerStatistic statistic )

bool

is_active ( ) const

void

peer_disconnect ( int data=0 )

void

peer_disconnect_later ( int data=0 )

void

peer_disconnect_now ( int data=0 )

void

ping ( )

void

ping_interval ( int ping_interval )

void

reset ( )

Error

send ( int channel, PackedByteArray packet, int flags )

void

set_timeout ( int timeout, int timeout_min, int timeout_max )

void

throttle_configure ( int interval, int acceleration, int deceleration )


Enumerations

enum PeerState:

PeerState STATE_DISCONNECTED = 0

The peer is disconnected.

PeerState STATE_CONNECTING = 1

The peer is currently attempting to connect.

PeerState STATE_ACKNOWLEDGING_CONNECT = 2

The peer has acknowledged the connection request.

PeerState STATE_CONNECTION_PENDING = 3

The peer is currently connecting.

PeerState STATE_CONNECTION_SUCCEEDED = 4

The peer has successfully connected, but is not ready to communicate with yet (STATE_CONNECTED).

PeerState STATE_CONNECTED = 5

The peer is currently connected and ready to communicate with.

PeerState STATE_DISCONNECT_LATER = 6

The peer is slated to disconnect