01-07-2016, 02:22 AM
I was asked to explain the system to someone wanting to use it, and my explanation went quite in detail so I'll post it here too:
MagicalGentleman Wrote:the network hardware is pretty much finished yeah, but due to the issue of redstone in unloaded chunks, a large scale network isn't feasible at the moment.
so, at the moment there isn't a network to connect to xD
you could use a router for your own local network though, that is totally possible. If you go to my plot (/p visit MagicalGentleman) there's two routers sunk halfway into my plot floor. You could copy one of those to use for yourself, one router can serve 3 unique IPs and is designed to promote up to a parent router if there isn't a match.
There's a hatch at the top of each router which has signs explaining how that particular router is programmed. Each router is unique so it's kind of like MAC addresses (? lol)
If you look at the two on my plot, one will have more bits programmed than the other. You'll want to take that one as that's the one programmed for unique IPs, the second one with more XX terms on the signs is for communicating with different routers.
If you fly down the hatch directly below the signs you'll see torches and repeaters on 4 decoders corresponding to what is written on those signs. That's basically the routing table for that particular router, to do what the signs say.
To actually USE the router, your sender must follow the following rules:
Send a 2 tick request (REQ) pulse on a request line, and wait for a returning 2 tick acknowledge (ACK) pulse from the router. When you get that response, the router is now waiting for you to send a packet.
To send the packet you MUST use 1 tick per bit serial. For every pair of bytes you send on the two data lines, you need to pulse the initiate line on the same tick as the first bit. (ask around for dylanrussel's serial designs. I use his protocols) The data packets can be any multiple of 2 bytes from 2 to 10 bytes. It follows this organisation:
Code:Each [] is 8 bits
Serial Line A: [IP address][D0][D2][D4][D6]
Serial Line B: [optional info][D1][D3][D5][D7]
The IP address must not contain a pair of ones.
e.g. 01 10 00 01 is fine, but 01 10 11 01 is not fine!
each pair of bits is actually representing a ternary/trinary number. Threes are just easier to work with when trying to connect groups of routers together in the long run. If the router detects a 11, It will automatically delete the packet you send it.
Do whatever you want with the optional info byte. It's just bonus space as the main info for the router is just the IP.
The key for the different data lines are on the router where the main inputs are.
The black box with the lever behind it is for hard resetting the router. That fixes any worldedit bugs you might have from moving it, or if the router is waiting for a response that will never come.
(will be explained in a sec)
To receive data from the router, you will first get a REQ from it, just like how you sent a REQ to send to it. You need to respond to that REQ as quick as you can with an ACK so you don't lock up the router! It will wait for your response forever if you don't talk back to it! (I haven't implemented a timeout D: )
After you respond the router will immediately start sending the packet to you in the same form as you would send stuff yourself. (again, dylanrussel's serial designs, there should be a receiver or two lying around)
One important thing to keep in mind is that I haven't tested packets larger than 2 bytes yet! The router should send and receive packets up to 10 bytes fine, but it might not be able to handle more than one request in quick succession. I fear it might send both packets to the first IP D: