UdpBindOptions
Options used to bind a UDP socket and bound its datagrams.
Advanced app/host integration API. Useful for lower-level work; ordinary app authors can start with the app-building path. This is public API, not permission to access private toolkit objects.
Example
Section titled “Example”Where to put it: replace Src/Main.luau in a project created with this SDK. This is the complete entry file.
Project setup: add network.raw, network.client, network.server to Capabilities in lui.json. See the capability guide.
local Window = Instance.new("Window", { Title = "LUI example", Size = UDim2.fromOffset(560, 280),})local Status = Instance.new("TextLabel", { Parent = Window, Text = "Ready", Position = UDim2.fromOffset(16, 170), Size = UDim2.new(1, -32, 0, 72),})local Network = app:GetService("NetworkService")local Receiver = Network:BindUdp({Address = "loopback", Port = 0, MaxDatagramBytes = 1024})local Sender = Network:BindUdp({Address = "loopback", Port = 0, MaxDatagramBytes = 1024})task.spawn(function() local Packet = Receiver:ReceiveFromAsync() Status.Text = buffer.tostring(Packet.Data) .. " from " .. Packet.RemoteEndpoint.Address Receiver:Close()end)task.spawn(function() Sender:SendToAsync(Receiver.LocalEndpoint, "Hello UDP") Sender:Close()end)Window.Destroying:Connect(function() Receiver:Close(); Sender:Close() end)Window.Visible = trueExpected result: Sends one local datagram and displays its bytes and sender. UDP delivery is not guaranteed outside this demonstration.
Properties
Section titled “Properties”Address
Section titled “Address”Local bind address; loopback keeps traffic on this machine.
Type: string?. Read/write field.
Family
Section titled “Family”IPv4 or IPv6. UDP has no DualStack option in this profile.
Type: ("IPv4" \| "IPv6")?. Read/write field.
Local port; 0 requests a free port if allowed by policy.
Type: number. Read/write field.
MaxDatagramBytes
Section titled “MaxDatagramBytes”Maximum accepted datagram size, in bytes. A datagram is one UDP packet payload, unlike a TCP byte stream.
Type: number?. Read/write field.
Full type declaration — for type checking and deeper reference
The declaration is generated from the SDK. Self is supplied by a colon call; read means the field cannot be assigned. See how to read this reference.
export type UdpBindOptions = { Address: string?, Family: ("IPv4" | "IPv6")?, Port: number, MaxDatagramBytes: number?,}Availability and deeper reading
Section titled “Availability and deeper reading”See platform limits before relying on host-specific behavior. The framework design specification and reflection/type sources are deeper engineering references, not extra setup required to build an app.