PacketPeerUDP

Inherits: PacketPeer < Reference < Object

Category: Core

Brief Description

UDP packet peer.

Member Functions

void close ( )
String get_packet_ip ( ) const
int get_packet_port ( ) const
bool is_listening ( ) const
Error listen ( int port, int recv_buf_size=65536 )
void set_ip_type ( int ip_type )
int set_send_address ( String host, int port )
Error wait ( )

Description

UDP packet peer. Can be used to send raw UDP packets as well as :ref:`Variant<class_variant>`s.

Member Function Description

  • void close ( )

Close the UDP socket the PacketPeerUDP is currently listening on.

  • String get_packet_ip ( ) const

Return the IP of the remote peer that sent the last packet(that was received with get_packet or get_var).

  • int get_packet_port ( ) const

Return the port of the remote peer that sent the last packet(that was received with get_packet or get_var).

  • bool is_listening ( ) const

Return whether this PacketPeerUDP is listening.

  • Error listen ( int port, int recv_buf_size=65536 )

Make this PacketPeerUDP listen on the “port” with a buffer size “recv_buf_size”. Listens on all available addresses.

  • void set_ip_type ( int ip_type )

Set the destination address and port for sending packets and variables, a hostname will be resolved using if valid.

  • Error wait ( )

Wait for a packet to arrive on the listening port, see listen.