rednet.send

From ComputerCraft
Jump to: navigation, search

rednet.send
Function
Syntax
rednet.send()
Returns bool success
API rednet
Source Rednet API (source)

Sends a Rednet message to be received by a specific computer (whose id is id.) Takes another optional parameter, protocol, which specifies what the message is for. It returns false if the message was unable to be sent, but true if it was sent.

Make sure your modem is opened with rednet.open!

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.

ExampleExampleSend a message to a computer
We send a message to the computer whose id is 567. If the message could be sent, we should see an output of true:
Code
print(rednet.send(567, "Hello world!"))
Output
true
ExampleExampleSend a message to a computer with a protocol
We now send a message to the computer whose id is 890, with a protocol of "ComputerCraft". If it was sent, we will see a true output:
Code
print(rednet.send(890, "Hello world!", "ComputerCraft"))
Output
true