15 lines
314 B
GDScript
15 lines
314 B
GDScript
extends NetworkNode
|
|
|
|
@export var ip := "127.0.0.1"
|
|
@export var port := 4242
|
|
|
|
var socket := PacketPeerUDP.new()
|
|
|
|
func _init():
|
|
super._init()
|
|
socket.connect_to_host(ip, port)
|
|
|
|
func _process(_delta):
|
|
while socket.get_available_packet_count() > 0:
|
|
var packet := socket.get_packet()
|
|
handle_packet(packet, socket) |