PacketPeerUDP¶
Inherits: PacketPeer < Reference < Object
Category: Core
Brief Description¶
UDP packet peer.
Member Functions¶
void | close ( ) |
int | get_packet_address ( ) const |
String | get_packet_ip ( ) const |
int | get_packet_port ( ) const |
bool | is_listening ( ) const |
Error | listen ( int port, int recv_buf_size=65536 ) |
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.
- int get_packet_address ( ) const
Return the address of the remote peer(as a 32bit integer) that sent the last packet(that was received with get_packet or get_var).
- 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.
Make this PacketPeerUDP listen on the “port” using a buffer size “recv_buf_size”. Listens on all available adresses.
Set the destination address and port for sending packets and variables, a hostname will be resolved if valid.
- Error wait ( )
Wait for a packet to arrive on the listening port, see listen.