mirror of
https://github.com/godotengine/godot-docs.git
synced 2026-01-04 14:11:02 +03:00
classref: Sync with current master branch (c64afeb)
This commit is contained in:
@@ -43,7 +43,7 @@ Below a small example of how it can be used:
|
||||
func _process(delta):
|
||||
server.poll() # Important!
|
||||
if server.is_connection_available():
|
||||
var peer : PacketPeerUDP = server.take_connection()
|
||||
var peer: PacketPeerUDP = server.take_connection()
|
||||
var packet = peer.get_packet()
|
||||
print("Accepted peer: %s:%s" % [peer.get_packet_ip(), peer.get_packet_port()])
|
||||
print("Received data: %s" % [packet.get_string_from_utf8()])
|
||||
@@ -112,7 +112,7 @@ Below a small example of how it can be used:
|
||||
func _process(delta):
|
||||
if !connected:
|
||||
# Try to contact server
|
||||
udp.put_packet("The answer is... 42!".to_utf8())
|
||||
udp.put_packet("The answer is... 42!".to_utf8_buffer())
|
||||
if udp.get_available_packet_count() > 0:
|
||||
print("Connected: %s" % udp.get_packet().get_string_from_utf8())
|
||||
connected = true
|
||||
@@ -137,7 +137,7 @@ Below a small example of how it can be used:
|
||||
if (!_connected)
|
||||
{
|
||||
// Try to contact server
|
||||
_udp.PutPacket("The Answer Is..42!".ToUtf8());
|
||||
_udp.PutPacket("The Answer Is..42!".ToUtf8Buffer());
|
||||
}
|
||||
if (_udp.GetAvailablePacketCount() > 0)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user