rednet.send

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.

rednet.send
Function
Syntax
rednet.send(
  • id : number
  • message : any
  • protocol? : string
)

Returns bool success
API rednet
Source Rednet API (source)

Make sure your modem is opened with rednet.open!

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

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

ExampleSend 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
<nowiki>
print(rednet.send(567, "Hello world!"))
    </nowiki>
Output
true
ExampleSend 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
<nowiki>
print(rednet.send(890, "Hello world!", "ComputerCraft"))
    </nowiki>
Output
true
This article is issued from Computercraft. The text is licensed under Creative Commons - Attribution - Sharealike. Additional terms may apply for the media files.