Difference between revisions of "Rednet.send"

From ComputerCraft Wiki
Jump to: navigation, search
(Undo revision 1826 by 37.59.80.67 (talk))
Line 2: Line 2:
 
{{Function
 
{{Function
 
|name=rednet.send
 
|name=rednet.send
|args=[[int]] receiverID, [[string]] message
+
|args=[[int]] receiverID, [[string]] message, [[boolean]] WaitUntilPortOpen
 
|returns=[[boolean]] success code. True if a message has been sent, false if not. "true" does not guarantee, that the destination was reachable!
 
|returns=[[boolean]] success code. True if a message has been sent, false if not. "true" does not guarantee, that the destination was reachable!
 
|api=rednet
 
|api=rednet
 
|addon=ComputerCraft
 
|addon=ComputerCraft
|desc=Sends a message to a Computer. (see [[rednet.broadcast( message )]] and [[rednet.receive( timeout )]].<br />To get the id from a computer see [[os.computerID()]].
+
|desc=Sends a message to a Computer. (see [[rednet.broadcast( message )]] and [[rednet.receive( timeout )]].<br />To get the id from a computer see [[os.computerID()]]. Setting WaitUntilPortOpen to True can help when the server is not receiving a response from the responding client.
 
|examples=
 
|examples=
 
{{Example
 
{{Example
|desc=Sends a Message to the Computer with the ID 22 (assuming a modem is attached and open)
+
|desc=Sends a Message to the Computer with the ID 22 (assuming a modem is attached and open), and will wait until the port is available to use.
|code=rednet.send(22,"ComputerCraft")
+
|code=rednet.send(22,"ComputerCraft", true)
 
}}
 
}}
 
}}
 
}}

Revision as of 02:52, 29 August 2012


Grid Redstone.png  Function rednet.send
Sends a message to a Computer. (see rednet.broadcast( message ) and rednet.receive( timeout ).
To get the id from a computer see os.computerID(). Setting WaitUntilPortOpen to True can help when the server is not receiving a response from the responding client.
Syntax rednet.send(int receiverID, string message, boolean WaitUntilPortOpen)
Returns boolean success code. True if a message has been sent, false if not. "true" does not guarantee, that the destination was reachable!
Part of ComputerCraft
API rednet

Examples

Grid paper.png  Example
Sends a Message to the Computer with the ID 22 (assuming a modem is attached and open), and will wait until the port is available to use.
Code
rednet.send(22,"ComputerCraft", true)