Difference between revisions of "Rednet (API)"

From ComputerCraft Wiki
Jump to: navigation, search
Line 1: Line 1:
 
The rednet API provides a simple computer networking model over RedPower bundled cables.
 
The rednet API provides a simple computer networking model over RedPower bundled cables.
 
+
{| border="1" cellpadding="2" cellspacing="0"
Functions for specifiying sides to be used for networking;
+
!style="background:#EEE" width="200px"|Method name
*rednet.open( side )
+
!style="background:#EEE" width="*"|Description
*rednet.close( side )
+
|-
 
+
|rednet.open( side )
Functions for sending messages to other computers;
+
|Tells the computer that the side can be used for networking.
*rednet.announce()
+
|-
*rednet.send( receiverID, message )
+
|rednet.close( side )
*rednet.broadcast( message )
+
|Tells the computer that the side can no longer be used for networking.
 
+
|-
Functions for receiving messages:
+
|rednet.announce()
*rednet.receive( timeout ) -- Returns: senderID, message
+
|<no description given>
*You can also handle the "rednet_message" event to receive messages without calling receive(), the arguments are the same as the receive() return values.
+
|-
 +
|rednet.send( receiverID, message )
 +
|Sends a message to the computer using the opened sides.
 +
|-
 +
|rednet.broadcast( message )
 +
|Sends the message to ALL computers.
 +
|-
 +
|rednet.receive( timeout )
 +
|Receives packets. Usage: senderID, message = rednet.receive(5) and the like. It sends the ID of the sender, and the message.
 +
|}
 +
You can also handle the "rednet_message" event to receive messages without calling receive(), the arguments are the same as the receive() return values.
 
[[Category:APIs]]
 
[[Category:APIs]]

Revision as of 05:43, 31 January 2012

The rednet API provides a simple computer networking model over RedPower bundled cables.

Method name Description
rednet.open( side ) Tells the computer that the side can be used for networking.
rednet.close( side ) Tells the computer that the side can no longer be used for networking.
rednet.announce() <no description given>
rednet.send( receiverID, message ) Sends a message to the computer using the opened sides.
rednet.broadcast( message ) Sends the message to ALL computers.
rednet.receive( timeout ) Receives packets. Usage: senderID, message = rednet.receive(5) and the like. It sends the ID of the sender, and the message.

You can also handle the "rednet_message" event to receive messages without calling receive(), the arguments are the same as the receive() return values.