Request to receive datagram. Specified script will be called when datagram will be received. Note that only one datagram will be received for a single request() call. Multiple requests may be scheduled.
Plugin script file that will be called with recieved data
Any data which will be passed to callback
Maximum size of the datagram to be retrieved. If omitted, the maximum datagram size is used (which
is currently limited by the implementation to 8192 bytes).
User data passed to request() call
local params = ...
local network = require("network")
if params.event == "request" then
print(params.data.user_data .. params.data.datagram)
local handle = network.udp();
network.setsockname(handle, "*", "8021")
network.sendto(handle, "Is there anyone?", "192.168.1.255", "8021")
network.request(handle, "this_script_name", "Found: ")
How can we help?
A premium WordPress theme with integrated Knowledge Base,
providing 24/7 community based support.