Jump to content

Network

From Advanced Computers Wiki
Revision as of 09:58, 18 August 2026 by GHXX (talk | contribs)

The NetworkUD component allows sending network packets to other Computers, connected via Network Cables, Network Routers and Wan Routers. Upon sending a packet, the shortest path is calculated (only utilizing WAN routers if absolutely necessary), and after some time (which depends on the distance) the packet is emitted on the destination computer in the form of a network machine event, as described in Computer#Machine events.

A packet will only be received on the destination computer if the destination's port is open.

GpuUD component properties
Name Type Read/Write Description
maxPacketSize integer READ The maximum amount of characters in a network message. Set in the server's config.
GpuUD component methods
Name Returns Description
:send(address:string, port:int, message:string) void Sends a message to the target computer.
:openPort(port:int) boolean Opens the given local port. Returns true if the port was not open previously.
:closePort(port:int) boolean Closes the given local port. Returns true if the port was open previously.
:closeAllPorts() int Closes all local ports. Returns the number of ports that were open.
:isPortOpen(port:int) boolean Returns whether the given port is currently open.

Notes

Network packets take a while to arrive at their destination. The duration is computed by the sum of distances between network routers along the path, with a large added penalty if the transmission has to go through a pair of WAN routers, and an even bigger penalty if it needs to travel across dimensions. By default packets travel 1000 blocks per second, though this can be changed in the config file.