NetworkConnectOptions
Options used to establish an outbound TCP connection.
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”Advanced raw networking. Calls that wait for I/O belong in task.spawn/task.defer; normal HTTP apps can use HttpService instead.
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 Listener = Network:ListenTcp({Address = "loopback", Port = 0})task.spawn(function() local Peer = Listener:AcceptAsync() local Bytes = Peer:ReadExactAsync(4) Peer:WriteAsync(Bytes) Peer:Close() Listener:Close()end)task.spawn(function() local Peer = Network:ConnectTcp({Address = "127.0.0.1", Port = Listener.Port}) Peer:WriteAsync("ping") local Reply = Peer:ReadExactAsync(4) Status.Text = buffer.tostring(Reply) Peer:Close()end)Window.Destroying:Connect(function() Listener:Close() end)Window.Visible = trueExpected result: A local TCP client sends four bytes and receives the echo. The fixed four-byte length is this example’s framing rule, not a TCP message boundary.
Properties
Section titled “Properties”Address
Section titled “Address”Destination hostname or IP address. Host policy can restrict it to loopback.
Type: string?. Read/write field.
Destination port from 1 to 65535.
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 NetworkConnectOptions = { Address: string?, Port: 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.