Attention | Topic was automatically imported from the old Question2Answer platform. | |
Asked By | fractile | |
Old Version | Published before Godot 3 was released. |
I have been trying to create a simple app in Godot (my first ever) that sends raw UDP packets on button press. It works fine on desktop, but not on Android (connected to same wifi).
The put_packet() functions seems to return mysterious error code 1 on Android. What does that mean?
Here’s the script:
var udp = PacketPeerUDP.new();
var data = RawArray()
func _ready():
# Called every time the node is added to the scene.
# Initialization here
udp.set_send_address("192.168.1.84", 16001)
data.push_back(0)
data.push_back(0)
data.push_back(0)
data.push_back(0)
func _on_left_button_pressed():
data.set(0,1)
var err = udp.put_packet(data)
if(err == OK):
get_node("TitleLabel").set_text("left")
else:
get_node("TitleLabel").set_text("Error: " + str(err))
Where are these errors codes documented? I took a quick look at Godot source code, but didn’t find them there either…
I found the posix packet peer udp source code and it seems that error code 1 means “generic fail error”, which isn’t very helpful…
Any ideas on how I can debug this further?
fractile | 2016-03-13 11:27
Did you try other ports? Or maybe the netmask is blocking?
In ´drivers/unix/packet_peer_udp_posix.cpp´ the relevant stuff hapens.
So either socket() or sento() seems to return -1.
Unfortunately godot doesn’t observe errno which is set by these functions.
Without editing the source code to look up errno and recompiling you won’t find out what went wrong…
peeet | 2016-03-13 14:47
I haven’t tried other ports, but I don’t think this is a network problem, because UDP packets sent by “UDP sender” app from the same phone to same address/port work just fine.
fractile | 2016-03-13 15:08