rednet.host

From ComputerCraft Wiki
Jump to: navigation, search


Grid Redstone.png  Function rednet.host
Introduced by ComputerCraft 1.6, registers the system as "hosting" the desired protocol under the specified name. If a rednet lookup is performed for that protocol (and maybe name) on the same network, the registered system will automatically respond via a background process, hence providing the system performing the lookup with its ID number.

Multiple computers may not register themselves on the same network as having the same names against the same protocols, and the title "localhost" is specifically reserved. They may, however, share names as long as their hosted protocols are different, or if they only join a given network after "registering" themselves before doing so (eg while offline or part of a different network).

See also: rednet.lookup(), rednet.unhost()
Syntax rednet.host(string protocol, string hostname)
Returns Nothing
Part of ComputerCraft
API rednet

Examples

Grid paper.png  Example
Registers the system as using the protocol "futonFolderComs" under the hostname "futonFolderServer". It'll respond to lookup requests (such as the example code for rednet.lookup()) until such time as rednet is closed, the name is unregistered (via rednet.unhost()), or the system is rebooted.
Code
rednet.open("top")

rednet.host("futonFolderComs","futonFolderServer")


Grid disk.png Rednet API Functions
rednet.open - rednet.close - rednet.send - rednet.broadcast - rednet.receive - rednet.isOpen - rednet.host - rednet.unhost - rednet.lookup
Personal tools
Namespaces
Variants
Actions
Navigation
Toolbox