LensStudio:Network.Address
ClassA TCP Server address.
A TCP Server address. Use with "LensStudio:Network".TcpServer.
Index
Example
// Address is a simple data class from LensStudio:Network that represents
// a TCP server address (host + port). It is passed to BaseServer.listen()
// and TcpServer.listen() to specify where the server should bind.
//
// Constructor: new Address() — creates an Address with default values.
// Properties:
// address: string — the host to bind to (no schema prefix like "http://")
// port: number — the port number
const { Address } = await import('LensStudio:Network');
const addr = new Address();
addr.address = '127.0.0.1';
addr.port = 8080;
console.log('Created Address instance');
console.log(' address:', addr.address);
console.log(' port:', addr.port);
// Change to a different binding
addr.address = '0.0.0.0';
addr.port = 3000;
console.log('Updated Address to', addr.address + ':' + addr.port);
Constructors
Constructor
new Address():
Address
Constructs a new TCP server address instance for use with TcpServer.
Returns
Address
Properties
address
address:
string
The address of the server. You should never pass in an address that includes a schema part (e.g. "http://", "ws://", etc.).
port
port:
number
The port to connect to.