DragonOSA RedPower revival

Messages and programs

Send text between computers from DragonOS, DragonBASIC, the shell and ComputerCraft.

Computers exchange short text messages over UDP. Each Network Card has an inbox of 64 messages, which waits for the computer if its chunk is not loaded.

From the desktop

The Network window shows the card's MAC address, IP address, gateway, link and inbox, the hosts it can reach (each with Ping), and received messages. Next card selects another card.

From the shell

nethosts
netsend 192.168.88.11 hello from the farm
netrecv
netrecv -a

netrecv prints the oldest waiting message and its sender; -a prints them all. Add -I eth1 to use another card.

From DragonBASIC

A two-computer chat. Run it on both, each pointing at the other's address:

10 INPUT "PEER IP"; P$
20 PRINT "PRESS S TO SAY SOMETHING"
30 K$ = INKEY$
40 IF K$ = "S" THEN INPUT "SAY"; M$ : NETSEND P$, M$
50 IF NETCOUNT > 0 THEN M$ = NETRECV$ : PRINT NETFROM$; "> "; M$
60 SLEEP 2 : GOTO 30

All the network functions are listed on DragonBASIC machine commands.

From ComputerCraft

With CC: Tweaked installed, the Network Card is a ComputerCraft peripheral of type redpower_network.

Method Does
getMacAddress() The card's MAC address.
getIpAddress(), setIpAddress(ip) Read or set the address.
getPrefixLength() The prefix length.
getGateway(), setGateway(ip) Read or set the gateway.
dhcp() Get an address by DHCP.
isLinked() Whether the card has a link.
send(ip, text) Send a message.
receive() The next message.
waiting() How many messages are waiting.
ping(ip) Round-trip time.
hosts() Reachable computers.
local card = peripheral.find("redpower_network")
card.dhcp()
print("I am " .. card.getIpAddress())
card.send("192.168.88.11", "hello")