|  Developer
Updated on January 3, 2023

setoption()

  • Sets options for the UDP socket. Options are only needed by low-level or time-critical applications. You should only modify an option if you are sure you need it.
  • Option is a string with the option name, and value depends on the option being set
Edit
Parameter Type Required Description
handle int + Connection handle
option string + Option name
value depends Option value

Supported options

Option Value type Default value Description
bool True Requests permission to send broadcast datagrams on the socket
bool True Requests to join a multicast group on the socket
bool True Requests to leave a multicast group on the socket
Edit
Nothing
Edit
Edit
				
					local network = require("network")
local handle = network.udp();
network.setoption(handle, "broadcast")				
			
Edit
				
					local network = require("network")
local handle = network.udp();
network.setoption(handle, "ip-add-membership")				
			
Edit
				
					local network = require("network")
local handle = network.udp();
network.setoption(handle, "ip-drop-membership")