This is a read-only snapshot of the ComputerCraft forums, taken in April 2020.
rahph's profile picture

Control redstone over wireless modems!

Started by rahph, 25 July 2017 - 07:03 PM
rahph #1
Posted 25 July 2017 - 09:03 PM
Tired of long, boring redstone lines going through all of your worlds?
Want something quick and nice?
Have computercraft?

I present to you
The remote redstone procol!

How does it work?
You set up a "server". It runs the rrp-server program and accepts remote signals.
Then, on clients you install the client. Seems self explanatory. The client can synchronise with up to 15 servers and send them ON / OFF / Simulate button press signals.

How to set it up?
Server:


Download the server software ( Xfbp9Aqx ) and save it. Run it with the argument "regen" to create / rebuild the .rrp file which stores the synchronisation key, channel and header.
Run the server. You need at least 1 modem connected to the server computer. The default redstone output side is back, but you can change it by altering the server file.
IT should look like this


Client:
Download the client software ( wUjM3Pva ) and run it. It should look like this:


Select an option and follow on-screen instructions. To add a server, type in "1". The sync-key is displayed in the server software.


BOTH SIDES NEED TO HAVE AT LEAST 1 MODEM CONNECTED! Server requires at least 21x3 screen.
I hope you enjoy my crappy piece of code and have some use out of it.
Both programs are released to the public domain. Do whatever you want.
Edited on 25 July 2017 - 08:48 PM
rahph #2
Posted 25 July 2017 - 10:57 PM
The communication protocol has been documented.
https://markdownshare.com/view/d8807de3-38b8-443a-b15a-f8ec6164f152
buzzawak #3
Posted 26 July 2017 - 12:08 AM
Hi Rahph, not really sure what your setup does?

The link https://markdownshar...5a-f8ec6164f152 is not working

Does the server receive a redstone signal and passes the level and duration on to the client ?
Edited on 25 July 2017 - 10:10 PM
The Crazy Phoenix #4
Posted 26 July 2017 - 12:14 AM
You may be able to use those sync keys to add a layer of security to your protocol.

For example, if you were to generate a server ID from the sync key (which you'd keep secret), you could then create a single hash of the message, sync key and some sort of timestamp (to prevent someone from retransmitting a previously transmitted message).
Then all the server needs to do is hash the received message with its copy of the sync key and compare it to the received hash to verify that the sender can be trusted.
It may not be as good as one-way key encryption, but it's certainly better than nothing and very easy to implement. There are plenty of SHA-1 implementations on these forums.
Edited on 25 July 2017 - 10:14 PM
rahph #5
Posted 26 July 2017 - 07:44 AM
Hi Rahph, not really sure what your setup does?
The link https://markdownshar...5a-f8ec6164f152 is not working
Does the server receive a redstone signal and passes the level and duration on to the client ?

Weird… The link works for me.

The setup allows the client to control servers redstone output. Example: Lights in my dirt shed are connected to the server and I can turn them on/off from my pocket computer.

You may be able to use those sync keys to add a layer of security to your protocol.
For example, if you were to generate a server ID from the sync key (which you'd keep secret), you could then create a single hash of the message, sync key and some sort of timestamp (to prevent someone from retransmitting a previously transmitted message).
Then all the server needs to do is hash the received message with its copy of the sync key and compare it to the received hash to verify that the sender can be trusted.
It may not be as good as one-way key encryption, but it's certainly better than nothing and very easy to implement. There are plenty of SHA-1 implementations on these forums.

I could do this yes, but I find the current solution secure enough. Also I don't want the protocol to be tricky to implement.
buzzawak #6
Posted 26 July 2017 - 10:09 AM
Will it work across chunks ?
rahph #7
Posted 26 July 2017 - 10:46 AM
Will it work across chunks ?

As long as both sides are loaded, yes. It uses the normal modem api.
rahph #8
Posted 26 July 2017 - 09:49 PM
Fixed client crashing on adding profiles with 2 or more modems connected at once.