Click or drag to resize

PacketPeerUDPWait Method

Waits for a packet to arrive on the listening port. See Listen(Int32, String, Int32).

Note: Wait can't be interrupted once it has been called. This can be worked around by allowing the other party to send a specific "death pill" packet like this:

# Server
socket.set_dest_address("127.0.0.1", 789)
socket.put_packet("Time to stop".to_ascii())

# Client
while socket.wait() == OK:
    var data = socket.get_packet().get_string_from_ascii()
    if data == "Time to stop":
        return

Namespace:  Godot
Assembly:  GodotSharp (in GodotSharp.dll) Version: 1.0.0
Syntax
C#
public Error Wait()

Return Value

Type: Error

[Missing <returns> documentation for "M:Godot.PacketPeerUDP.Wait"]

See Also