rednet.open

From ComputerCraft
Jump to: navigation, search

rednet.open
Function
Syntax
rednet.open()
Returns nil
API rednet
Source CC:Tweaked (source)

Opens rednet on the modem attached to side.

Note Note: This function call requires a Modem peripheral to be attached to the computer. See Networking for more information.

Note Note: Rednet is not secure against interception or spoofing. See Network security#Rednet for more information.

ExampleExampleOpen the top modem.
Opens rednet on the top modem of the computer.
Code
rednet.open("top")
Output Rednet events will now trigger on the top modem.
ExampleExampleOpen all connected modems
This is a little trick using peripheral.find. It accepts a function as the second argument, which is called for each matching peripheral. By using rednet.open here, every connected modem is opened.
Code
peripheral.find("modem", rednet.open)