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

Using HTTP and a web server as Rednet

Started by Vert3x, 16 July 2017 - 03:02 PM
Vert3x #1
Posted 16 July 2017 - 05:02 PM
Hello, I was wondering… I have a simple web server set up on my Raspberry PI. I have port-forwarded it and would like to use it for sending commands to other computers (via a master computer or a website). How would I do this? This would remove the need of me having to waste E pearls on modems. Thanks!
Bomb Bloke #2
Posted 17 July 2017 - 06:40 AM
You can't, exactly, at least not directly. Instead, you'd need to have your ComputerCraft systems send command requests to your web server.
Dave-ee Jones #3
Posted 17 July 2017 - 06:59 AM
You can't, exactly, at least not directly. Instead, you'd need to have your ComputerCraft systems send command requests to your web server.
Well, actually, you could have the computers listen in on a notepad file and when it changes it does something, like execute a command that was put there by the web server…

Oooo! Then you could have a CLI on a web page that controls multiple computers on a MC server! The possibilities for server admins…Deleting users, adding users, wiping a server, launching a disk..Manually controlling a PC that was hacked..
Bomb Bloke #4
Posted 17 July 2017 - 07:41 AM
Ah, true, if the web server has access to the Minecraft server's files, you could indeed have it write commands to a file on a ComputerCraft system's "drive" (located within the world save). That system would then simply need to read that file every few seconds to check for commands.


… although, if you have that level of control, then it's also possible to just generate multiple computers with the same ID number (if you can access your world save then you should also be able to use /give). These all share the same hard drive, allowing you to pull much the same communications trick without the need of any external software at all (we are just replacing rednet, right?) - HDeffo's pocket command computers provide a great example of this technique.
Anavrins #5
Posted 17 July 2017 - 03:19 PM
I remember an api doing just that, to receive a message it would make a request to a server, the server would not send anything but would keep the connection alive, only when a message was to be received that the server would respond and close the connection, the CC computer restarts the connection awaiting the next message.

I'll edit my post with the thread once I remember the name.
Edit: httpnet http://www.computercraft.info/forums2/index.php?/topic/15226-
Edited on 17 July 2017 - 01:29 PM