rednet.host

From ComputerCraft Wiki
Revision as of 06:04, 29 March 2014 by Bomb Bloke (Talk | contribs) (Created page with "{{lowercase}} {{Function |name=rednet.host |args={{type|string}} protocol, {{type|string}} hostname |returns=Nothing |api=rednet |addon=ComputerCraft |desc=Introduced by Compu...")

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
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, it'll automatically respond automatically via a background process, hence providing the remote system 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 that in 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")