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

LyqydNet Rednet API

Started by Lyqyd, 13 May 2012 - 04:00 AM
Lyqyd #1
Posted 13 May 2012 - 06:00 AM
So, I've been working on a rednet automatic networking API for a good little while now. It does automatic packet routing, peer discovery, and best-route finding. It can transport packets without loss across unloaded chunks whenever someone runs through the usually-unloaded areas, and it makes it very easy to write robust client-server applications. It is still under development, so feedback and bug reports are most welcome. It has been heavily tested and I use it extensively in my singleplayer world. This has not been tested on multiplayer.

Features:
  • Packet routing/forwarding
  • Transport packets across unloaded chunks
  • Automatic connection handling
  • Terminal redirection across rednet
  • Remote shell program
  • Rednet "repeat" program functionality on routers
  • Route packets efficiently between different networks
This API adds seamless support for background rednet event-activated server applications using coroutines. Complete documentation is included in the readme file. I am planning on writing up an auto-installation program to make things easier for those on multiplayer servers who don't have access to the actual computer files. No hard modification of the ROM files is necessary to run this.

I will be cleaning up and releasing the various applications I've written that utilize this, including a file server, remote shell, remote vault, a compatible version of the GPS program, and an in-progress chat program, over the next few weeks.

The best way to get LyqydNet is via packman, with the command packman install lyqydnet, as this will fetch LyqydNet automatically. You could also grab it from github.

Hope this helps!
tirankenja #2
Posted 20 May 2012 - 11:18 AM
Hey. I've been playing a little with this. But for some reason I am getting a crash when I try to connect to my server.

Specifically it will write this on my server:

net:180: bad argument: string expected, got nil

As far as I can tell it happens because the 'packet_receive' function returns nothing. But it IS getting the parameters it expects

Any idea what is going on?
tirankenja #3
Posted 20 May 2012 - 11:24 AM
Ah. Nevermind. I replaced the api files and rebooted. And not it seems to be working
tirankenja #4
Posted 20 May 2012 - 01:21 PM
And then it started failing again. Seems that it will crash because the routeTable is empty. So it never loops though it in net.packet_receive. But I am not quite sure why it sometimes work and sometimes not
Imgoodisher #5
Posted 20 May 2012 - 04:13 PM
I've been trying to make something with this, but its not working. for some reason the client won't send anything to the server. I'm pretty sure I have everything set up right, but its not very obvious how to set it up so I can't be sure I got everything. I have a client and server with

shell.run("modread")
shell.run("netd")
net.netInit()
in it, and a router with the same thing but with a shell.run("routed") before the net.netInit(). All the computers are labeled (server is labeled bankserver"), the server is running a daemon program that is pretty much the same thing as the one in the readme (name is account), but when I run connection.open("bankserver", "account", 2) it returns false. Why? did I miss something?
tirankenja #6
Posted 20 May 2012 - 07:46 PM
Not getting a connection for me seems to either being the server reusing an unclosed connection (the server in the readme seems to do that). Or if the /etc/hosts file not having the server in it. Provoking the latter to happen seems a bit random to me so far. But once it is there it seems to be working.

Edit:
So far I have been unable to get a connection over a router. So that could also be the problem
Lyqyd #7
Posted 21 May 2012 - 12:38 AM
Okay, I will start a new world and attempt to reproduce these errors. Thanks for the feedback, I should have answers for you guys shortly!
Lyqyd #8
Posted 21 May 2012 - 01:00 AM
Unfortunately, I can't reproduce either of these on a fresh world; my simple three-computer network (one router, two clients) manages to set up fine.

I will say that routing tables have trouble populating if a router isn't the first computer set up, or if computers previously set up are not rebooted after the last one is set up. This is because only routers will automatically distribute their route table when a computer starts up, to avoid some serious lag issues in dense networks.

I've been trying to make something with this, but its not working. for some reason the client won't send anything to the server. I'm pretty sure I have everything set up right, but its not very obvious how to set it up so I can't be sure I got everything. I have a client and server with

shell.run("modread")
shell.run("netd")
net.netInit()
in it, and a router with the same thing but with a shell.run("routed") before the net.netInit(). All the computers are labeled (server is labeled bankserver"), the server is running a daemon program that is pretty much the same thing as the one in the readme (name is account), but when I run connection.open("bankserver", "account", 2) it returns false. Why? did I miss something?

To help you troubleshoot this issue, I would like to see the route table (etc/hosts) on the router, the computer "bankserver" and the client attempting to connect to bankserver. Also, they are all inside rednet range, correct?

Here is a stripped-down network utility (programs/net) that allows you to view the route table or delete the route table (from memory and disk) on any computer:


local tArgs = { ... }
if tArgs[1] == "route" then
    --routes stuff
    if tArgs[2] == "print" then
        for rId, rInfo in pairs(net.routeTable) do
            print(rId..": "..rInfo.name.." ("..rInfo.gateway..":"..rInfo.cost..")")
        end
    elseif tArgs[2] == "flush" then
        net.routeTable = {}
        return net.netInit()
    end
else
    print("Usage: net route <print|flush>")
    --print("	   net shell <servername>")
end

Not getting a connection for me seems to either being the server reusing an unclosed connection (the server in the readme seems to do that). Or if the /etc/hosts file not having the server in it. Provoking the latter to happen seems a bit random to me so far. But once it is there it seems to be working.

Edit:
So far I have been unable to get a connection over a router. So that could also be the problem

Re-using unclosed connections generally hasn't caused any issues for me. I would be very interested to see it doing so. If there's anything you can send me to help reproduce the issue, I'd be very appreciative. Try the following in a new creative world (same as survival, but much faster for testing):

Create and label three computers. Set up one as a router and reboot it:


shell.run("modread")
shell.run("netd")
shell.run("routed")
net.netInit()

Then set up the other two as normal computers, and reboot them:


shell.run("modread")
shell.run("netd")
net.netInit()

If you have filed/filec installed, try running filed on one of the normal computers and running filec from the other. This should work. If so, try creating another computer just out of range of one normal computer, but in range of the router. Attempt a connection through the router this way.

To both; looking at the code, there is also an issue with an empty packet message. If a packet is sent with no message, it will break things due to the way packets are handled when being received. I'll look into adding a check for that, but the assumption that the packet message isn't empty is fairly common throughout the code.
Lyqyd #9
Posted 22 May 2012 - 01:49 AM
Updated with modified versions of rom/exit, rom/shutdown, and rom/reboot. Each of the modified versions simply adds a line at the top:


coroutine.resume(net.daemonTable.netd, 0, "SI:stop")

Which tells the network daemon (netd) to shut down.
Lyqyd #10
Posted 14 July 2012 - 09:36 AM
The LyqydNet API has been updated to use numbered sockets for input/output instead of server app names. Certain numbered sockets are reserved for certain types of programs, as follows:
  • 4 - network/routing daemons
  • 18 - relayed chat
  • 21 - file transfers
  • 23 - telnet/ssh/remote console
  • 25 - email
Sockets above 50 are used as-needed for outgoing connections, but could also be used to listen on if desired.

The new version also offers an unfinished version of terminal redirection over rednet. Using terminal.redirect(connection.text(#)) (replacing # with a connection number) will cause all screen commands to be sent over that connection. Use connection.processText() on the other end to receive it. Examples can be found in the LyqydNet-Programs repository (net and nshd). The net program, nshd, filec, and filed have all been updated and tested. These will work with the numbered sockets.

Proper documentation updates to follow at a later date.
minizbot2012 #11
Posted 16 July 2012 - 12:21 AM
Would it be possible to do a net shell in a net shell? that would be amazing, but as it seems right now i cannot edit a new file in a net shell (bug?). but i can seem to edit an existing file.
Lyqyd #12
Posted 16 July 2012 - 03:26 AM
No, a shell session within another shell session isn't currently possible (which implies an area of insufficiency in handling programs that require input), so that's the next step for it. That's probably going to be a tricky one, so it may not be soon. However, any net shell server available at one will be available at the first, so you could (for now) simply connect directly to the second one.

As for the file editing, that is certainly a bug. I'll look into that as soon as I can.
kazagistar #13
Posted 16 July 2012 - 12:53 PM
1) Is it SMP safe? If you can verify the correct functioning of all routers you have installed, can you know that packets have not been tampered with or inserted?
2) Is setup manual only? When you place a computer, do you need to manually specify its connections?
minizbot2012 #14
Posted 16 July 2012 - 09:32 PM
EDIT: this sounded stupid so i put it in spoilers
Spoileraww i was hoping to build the first ever proxy server in minecraft :P/>/>
Lyqyd #15
Posted 17 July 2012 - 01:00 AM
1) Is it SMP safe? If you can verify the correct functioning of all routers you have installed, can you know that packets have not been tampered with or inserted?
2) Is setup manual only? When you place a computer, do you need to manually specify its connections?
  1. To the extent that you can trust the endpoints and any routers in between, yes. If you don't trust both endpoints and any connecting routers, this is no more or less secure than any other networking system.
  2. Setup is done automatically. Each router builds and maintains a routing table of hosts, which it passes to each new host that connects. Hosts within range of each other will automatically update their routes to newly connected hosts, but the newly connected host has no knowledge of this. Newly joined hosts' information is not automatically distributed to other computers, but any event that causes the computer to reboot (chunk unload/reload, etc) will cause the updates to propagate.
Excellent questions! I'd be happy to provide further details of the exact process used in various aspects of the networking protocol.
kazagistar #16
Posted 17 July 2012 - 01:14 AM
This sounds really interesting, but I have a few questions… A is connected to B, and C wants to connect, and is only in range of B.

1) How does B know that C is a trusted host? How does C know that B is a trusted network access?

2) When does A get informed that it is connected to C (or how does it route messages there)?

3) When does C get informed that it is connected to A (or how does it route messages there)?

4) If there are any race conditions for loops, how do you handle them?

5) How do you deal with finding shortest paths, or do you do this?

Or do I misunderstand what automatic configuration entails?
Lyqyd #17
Posted 17 July 2012 - 01:34 AM
Would it be possible to do a net shell in a net shell? that would be amazing, but as it seems right now i cannot edit a new file in a net shell (bug?). but i can seem to edit an existing file.

The API has been updated (the netfile API, specifically) to address this bug. New files are now editable just like any other file. Thanks for the bug report!

This sounds really interesting, but I have a few questions… A is connected to B, and C wants to connect, and is only in range of B.

1) How does B know that C is a trusted host? How does C know that B is a trusted network access?

2) When does A get informed that it is connected to C (or how does it route messages there)?

3) When does C get informed that it is connected to A (or how does it route messages there)?

4) If there are any race conditions for loops, how do you handle them?

5) How do you deal with finding shortest paths, or do you do this?

Or do I misunderstand what automatic configuration entails?
  1. Neither B nor C have any way of knowing that the other can be "trusted". Routers are trusted implicitly, so malevolent routers are definitely something to be concerned with. If you have any ideas on workable trust schemes, please let me know. I haven't had reason to worry about it yet. I'd put network infrastructure interference on the same level as griefing, though.
  2. A will be informed the next time it is rebooted (manually, chunk reload, world reload) that A exists by B, assuming B is running the routed daemon. Alternatively, under the all-computers-are-routers scheme, it would know right away by B informing a fellow router that a new host has come online (this is not suggested due to network loads; all efforts to minimize routers should be made)
  3. Again assuming that B is a router and already knows about A, C will be told by B as soon as it comes online that B exists, and that A is one hop away through B.
  4. Race conditions are mostly avoided and/or ignored. All other things being equal, with two router-to-router notifications traveling around a loop, the first one to arrive would be considered the best. A later one with lower cost is even better.
  5. Shortest paths are found fairly quickly through the gateway/cost system I use to keep track of routes. Each router and host only knows the current best way to get to any given host for the first hop. It knows that sending a packet to router X will get the packet to host Z, and that it will pass through n hops to get there. If a better route becomes known, it will be used instead. So when each host comes online, any routers in range will forward on its information to all other routers that the nearest routers know about. It sends this information directly to each router, rather than trying to propagate the information between routers (which leads to infinite loops and dragons). So basically, we discard worse routes as better ones become known (by comparing the number of hops to the host between the two). Also, any time a packet is directly received (cost zero), we immediately update the routing table if we had a non-zero cost previously.
kazagistar #18
Posted 17 July 2012 - 02:21 AM
I see, so your network is somewhat static, in that it does not really handle path removal? Or do you just ignore the potential race condition of sending a "remove" and "connect" at near the same time?

Why don't you just instantly propagate network architecture changes? Have each router send a message to each connected router upon connect? Or just have another layer of protocol to handle this in some way?

And as for security, I would use a whitelist + password. You can get a list of computers on a network from a networked computer, toss it on a floppy, and have the new computer only connect to those trusted computers. It sends to each on the list instead of broadcast to try to connect. It sends a password with its request, which is unique to the network. If any network computer gets compromised, it will fail, but we can't do much better then that, without full public key cryptography.
Lyqyd #19
Posted 17 July 2012 - 03:11 AM
I see, so your network is somewhat static, in that it does not really handle path removal? Or do you just ignore the potential race condition of sending a "remove" and "connect" at near the same time?

Why don't you just instantly propagate network architecture changes? Have each router send a message to each connected router upon connect? Or just have another layer of protocol to handle this in some way?

And as for security, I would use a whitelist + password. You can get a list of computers on a network from a networked computer, toss it on a floppy, and have the new computer only connect to those trusted computers. It sends to each on the list instead of broadcast to try to connect. It sends a password with its request, which is unique to the network. If any network computer gets compromised, it will fail, but we can't do much better then that, without full public key cryptography.

Instant updates to other routers upon host join is the current behavior; instant updates to hosts is not (and is this way to reduce network lag issues upon loading chunks with high computer density). Host removal is planned, but I haven't settled on the conditions for removing a host. Right now, this would be the sort of thing one would do manually at each router and only very carefully. The network is very good at not losing host information.

A whitelisted mode is certainly a possibility, but I doubt if it would become the default behavior. The network API is designed to very quickly get a fully-functional network set up and running. Add a couple lines to each host, pick a computer to be the router (it can work without one, but having a router right off the bat makes things easier, certainly) and you're off to the races. Having people set up whitelists goes against the already-works-out-of-the-box idea, so it would be a special configuration option (just like the long-link functionality in routers currently is). PKI would be nice, but I don't see it happening. It would certainly be resource-intensive to the point of being prohibitive on most setups.

Edit: I don't know if it would interest you, but there is currently an open issue on the LyqydNet github repository in regards to route invalidation.
minizbot2012 #20
Posted 17 July 2012 - 09:45 PM
The example client / server pair is out of date. Is it possible that you can provide updated example client / servers?
Lyqyd #21
Posted 17 July 2012 - 09:47 PM
The example client / server pair is out of date. Is it possible that you can provide updated example client / servers?

Absolutely. I'll see about updating those tonight. They aren't too badly out of date, but the documentation needs updating due to the sockets model taking the place of named servers.
minizbot2012 #22
Posted 17 July 2012 - 09:48 PM
The example client / server pair is out of date. Is it possible that you can provide updated example client / servers?

Absolutely. I'll see about updating those tonight. They aren't too badly out of date, but the documentation needs updating due to the sockets model taking the place of named servers.
wow quick response and thank you.
Lyqyd #23
Posted 18 July 2012 - 04:42 AM
The example client / server pair is out of date. Is it possible that you can provide updated example client / servers?

Absolutely. I'll see about updating those tonight. They aren't too badly out of date, but the documentation needs updating due to the sockets model taking the place of named servers.
wow quick response and thank you.

The README has been updated with correct documentation and corrected background/foreground server and client example programs.
minizbot2012 #24
Posted 18 July 2012 - 08:21 PM
The example client / server pair is out of date. Is it possible that you can provide updated example client / servers?

Absolutely. I'll see about updating those tonight. They aren't too badly out of date, but the documentation needs updating due to the sockets model taking the place of named servers.
wow quick response and thank you.

The README has been updated with correct documentation and corrected background/foreground server and client example programs.
thank you very much.
gmt2001 #25
Posted 19 July 2012 - 01:08 AM
This is a very nice API and i am happy to finally see an "Internet" api which does not appear to be a cheap routing interface but rather a fully thought out api with all of the required things to make simulation of routing, TCP, and UDP possible which are all important if we wish to properly make the kind of client/server programs that everyone claims they are making.
minizbot2012 #26
Posted 19 July 2012 - 10:55 PM
i have built a prototype of a client file storage API, using this: http://www.computerc...ersistence-api/ persistence api, it is currently under heavy development using this system. Got variable retrieval working. :P/>/>

Lyqyd if you want the source i will happily provide it
Lyqyd #27
Posted 20 July 2012 - 03:59 AM
i have built a prototype of a client file storage API, using this: http://www.computerc...ersistence-api/ persistence api, it is currently under heavy development using this system. Got variable retrieval working. :P/>/>

Lyqyd if you want the source i will happily provide it

I'm a bit confused as to what you mean. Are you talking about making a LyqydNet-based file server?
minizbot2012 #28
Posted 20 July 2012 - 12:21 PM
Well I am not making a file server persay, but a way to store variables on the client, via a type of scripting language that can be sent through rednet without having to use loadstring(). Also it is sandboxed to a small area on the computer.
EDIT: encryption system did not work out :P/>/>
vipes2010 #29
Posted 29 August 2012 - 04:10 AM
This is a very cool networking API. I have been playing around with it as I'm working on a complex nuclear reactor control system with multiple computers controlling the reactor, cooling storage, uranium storage, and spent fuel storage pool.

Only thing I'm wondering about is if this can work over bundled cables… I can only get it to communicate over wireless modems.
Lyqyd #30
Posted 29 August 2012 - 03:57 PM
This is a very cool networking API. I have been playing around with it as I'm working on a complex nuclear reactor control system with multiple computers controlling the reactor, cooling storage, uranium storage, and spent fuel storage pool.

Only thing I'm wondering about is if this can work over bundled cables… I can only get it to communicate over wireless modems.

I don't see any reason why it couldn't be used for networking on bundled cables. You would probably need to open the side you wanted to use for networking manually, though. When I get home from work, I'll check the initialization function to see whether the lack of a wireless modem will keep initialization from happening properly. If it does, I'll add an argument to force usage of a specific side for networking, I think.
Lyqyd #31
Posted 31 August 2012 - 12:49 AM
Okay, I think this should work:

Download this version of the net API file, placing it where appropriate. Call the initialization function with a side argument, for whichever side you want to use for networking, thus:


net.netInit("back")

Bear in mind that networking over bundled cables is significantly slower (since the data is actually being transmitted in real time through rednet pulses, rather than being magicked from computer to computer), so certain protocols may be unpleasant to use, such as the terminal redirection over rednet. If you've got a fairly low network usage application in mind, you may not notice too much of a problem with latency.
Wolvan #32
Posted 01 September 2012 - 12:07 PM
Am I allowed to add this to my rednet API by giving full credit?
Lyqyd #33
Posted 01 September 2012 - 08:30 PM
Am I allowed to add this to my rednet API by giving full credit?

You are free to use portions of LyqydNet as inspiration, such as the terminal redirection over rednet or the magic directory functionality. Credit for these sorts of things is appreciated, but I'm pretty laissez-faire about that.

However, it doesn't make much sense to me for others to include LyqydNet in its totality as a part of another API. It would make much more sense if you were to require the LyqydNet API as a dependency, and then build on top of the work I've already done. LyqydNet is intended to operate as an intermediary layer to assist in simpler point-to-point communications via rednet. Additional modified versions of LyqydNet could create confusion and incompatibilities, which is something that I think is best to avoid.

If I may ask (and feel free to respond via PM instead), what is it about LyqydNet that you'd like to include? Having more information may allow me to answer your question more easily. Thanks for the interest!
robhol #34
Posted 10 October 2012 - 07:02 PM
Downloaded this yesterday and dropped the files in place. Unfortunately, I really can't get it to work.

I tried setting up a small network at my base, consisting of two computers and a router. Startup scripts are what they should be, modread netd (routed), and I tried netmon start at the router.
Basically, I tried both server versions from the README, and I can connect using the open command. As soon as I write anything else, both the server and client "lock up".

I tried rolling my own simple program, but was never able to connect to the server at all.


Are the docs and/or example programs out of date? Common issues? How do I fix it?
Lyqyd #35
Posted 11 October 2012 - 01:16 AM
The master branch is a bit out of date, pending documentation updates in the development branch. I do need to re-write the documentation for the example server and client, which I'll try to get to this weekend. In the meantime, the development branch of LyqydNet should be more fully-functional, though the documentation is still lacking. The example client and server in that branch don't look incorrect at a glance. This weekend, I'll be sure to vet those and push a fully-working and fully-documented version to the master branch. I'm sorry about the trouble you've had getting it up and running. One thing you might try (after installing the development branch) is seeing if you can get a net shell session up and running (client and server). Just run nshd (the server) on one computer, and use 'net shell <serverlabel>' on the other. If that can get up and running, the problems are with the example client/server, which means I really need to get it up to date.

Thanks for the interest!

Edit: Had a few minutes. Corrected example server (for use with the development branch of LyqydNet only):


local connections = {}

while true do
    --wait for input from client connections on socket 21.
    conn, messType, message = connection.listen(21)
    --okay, we have a packet, see if the connection is one we already
    --know about.
    if connections[conn] and connections[conn].status == "open" then
        --we can use additional entries in our 'connections' table
        --(which is internal to the server app) to store information
        --about client state, among other things.
        if messType == "data" then
            --handle client input here; use the connection number in
            --'conn' to send data back.
            print(message)
            connection.send(conn, "done", "OK")
            --break packet tells the client we are done transmitting
            --and are ready for the next command. This is optional. Some
            --types of servers wouldn't need to use this, e.g. a chat
            --server.
        elseif messType == "close" then
            --client has closed the connection, so let's close out
            --the connection information.
            connection.close(conn, disconnect, true)
            connections[conn].status = "closed"
            connections[conn].name = nil
        elseif messType == "instruction" then
            --these are local instructions. Often unused.
            if message == "stop" then
                return true
            end
        end
    elseif messType == "query" then
        --a client wants to open a connection
        if connections[conn] then
            --already have an entry for that connection number,
            --reset the information
            connections[conn].status = open
            connections[conn].name = connection.name(conn)
        else
            --no entry for this connection number, set up a new
            --entry.
            local connect = {}
            connect.status = "open"
            connect.name = connection.name(conn)
            table.insert(connections, conn, connect)
        end
        --either way we set up the connection, let the client know
        --it was successful.
        connection.send(conn, "response", "ok")
    end
end

The problem was that the server was sending back the wrong packet type after receiving a text response, so the client (waiting for a different packet) never saw the correct one arrive and just kept waiting. That's fixed in this example server, and I'll push the update to the documentation.
Namarius #36
Posted 11 October 2012 - 11:45 AM
It seems like that turtles aren't good routers. Is that correct? Because I have massive problems with setting up an always online network with turtle satellites.
Lyqyd #37
Posted 11 October 2012 - 05:57 PM
It seems like that turtles aren't good routers. Is that correct? Because I have massive problems with setting up an always online network with turtle satellites.

Well, routers are supposed to be stationary, so of they're moving around, computers will have a very difficult time maintaining connections. It's also possible that the turtle is overriding the computer-type code to show up as a turtle instead of a router. I'll take a look through the code tonight. In the meantime, your best bet is probably to use a turtle to establish a computer router with a disk drive and a startup file that sets up the local files on the new computer correctly.
robhol #38
Posted 11 October 2012 - 06:26 PM
Tried again using the new version. I can connect and send data, but apparently not connect, send, reconnect and send more, the client freezes after trying to send batch #2.

Net shell didn't work, I get "connection:298:expected number, number" on the client, the server says "remote command ls" like expected.

Have you, by the way, considered something UDP-like? If I just want to send a packet without messing around with connections etc.
Lyqyd #39
Posted 12 October 2012 - 02:08 AM
Tried again using the new version. I can connect and send data, but apparently not connect, send, reconnect and send more, the client freezes after trying to send batch #2.

Net shell didn't work, I get "connection:298:expected number, number" on the client, the server says "remote command ls" like expected.

Have you, by the way, considered something UDP-like? If I just want to send a packet without messing around with connections etc.

Heh. I'm an idiot. Didn't put "open" in quotes when setting the connection status, when you re-open a connection. That'd be a good thing to do. Corrected code:


local connections = {}

while true do
    --wait for input from client connections on socket 21.
    conn, messType, message = connection.listen(21)
    --okay, we have a packet, see if the connection is one we already
    --know about.
    if connections[conn] and connections[conn].status == "open" then
        --we can use additional entries in our 'connections' table
        --(which is internal to the server app) to store information
        --about client state, among other things.
        if messType == "data" then
            --handle client input here; use the connection number in
            --'conn' to send data back.
            print(message)
            connection.send(conn, "done", "OK")
            --break packet tells the client we are done transmitting
            --and are ready for the next command. This is optional. Some
            --types of servers wouldn't need to use this, e.g. a chat
            --server.
        elseif messType == "close" then
            --client has closed the connection, so let's close out
            --the connection information.
            connection.close(conn, disconnect, true)
            connections[conn].status = "closed"
            connections[conn].name = nil
        elseif messType == "instruction" then
            --these are local instructions. Often unused.
            if message == "stop" then
                return true
            end
        end
    elseif messType == "query" then
        --a client wants to open a connection
        if connections[conn] then
            --already have an entry for that connection number,
            --reset the information
            connections[conn].status = open
            connections[conn].name = connection.name(conn)
        else
            --no entry for this connection number, set up a new
            --entry.
            local connect = {}
            connect.status = "open"
            connect.name = connection.name(conn)
            table.insert(connections, conn, connect)
        end
        --either way we set up the connection, let the client know
        --it was successful.
        connection.send(conn, "response", "ok")
    end
end

Net shell works fine here. That error looks like it would be a malformed term.setCursorPos being sent to the client, which is unusual. I'll look into that a bit further. What are the contents of the directory you were trying to list? Perhaps there's an issue with certain sizings that tabulateCommon() does in the textutils library. I'd love to reproduce that error if I can.

I suppose free packet exchange is a possibility (a hacky workaround for this problem is used in my GPS modification; the PING packet is an attempt to connect to the GPS servers, the response is a connection-close packet; this is only good for single-packet exchanges). There is already a way to receive packets on a given port without futzing about with connections, though it leaves you on your own to sort out the header from the body of the message. Adding a connectionless send shouldn't be too hard (and will allow sending through any of computer label, route number (internal stuff), or computer ID, just like connection.open). I'll try to throw that together this weekend too, depending on other time constraints.
robhol #40
Posted 12 October 2012 - 07:32 AM
Haha, awesome. I'll give it a try later on.
I didn't change the directory, so it's the root dir or whatever's default.
CoolisTheName007 #41
Posted 13 November 2012 - 09:10 AM
I will say that routing tables have trouble populating if a router isn't the first computer set up, or if computers previously set up are not rebooted after the last one is set up. This is because only routers will automatically distribute their route table when a computer starts up, to avoid some serious lag issues in dense networks.
Does that means that if hosts startups before routers, all is lost? What about server restarts?
2nd EDIT: Do you mean problems on chunk loading? If so, consider:
-on 1st startup, e.g., block placement or program start, computers/turtles/routers (in the context of a more dynamic network, I would prefer the categories router/non-router) would update their routeTable: non-routers by waiting for a router to communicate, routers as usual
-then all save the routeTable to disk;
-on following startups, they reload the routeTable from disk;
-on normal operation after startup, this system is compatible with the static network that is implemented. For a new dynamic implementation, it needs behaviour that for each failed communication (failed as non-responding target during time-out) updates the routeTable and saves the new version. I suppose that's what the github issue talks about, so I would better get back to reading the API!

3rd EDIT: I thought about the problem of a computer starting up on a unknown location, and then provoking a huge network traffic as each router to which the HA packet got to had to send an update of the routerTable to everyone else (is that right?). I suggest having the new computer itself broadcast an HA, receiving the routerTable's from each reachable router, merging them somehow and sending an H(routerTable update) to each router and non-router; if the computer is a non-router it would have to distinguish between different groups of routers which aren't connected between them (maybe storing a network's members in the routerTable?).
Also, how do you deal with concurrent updates to different?
In graph language, each new edge of the connections graph is sent to everyone on the network?


That was a mess. Long story short: I want to help to make this API capable of supporting dynamic networks. In graph language, in the current version you have two kind of nodes : routers and non-routers, which forcefully are end nodes, eg. nodes with only one edge. How would you describe the new node update procedure in this language, as soon as a node enters the graph? Is every new edge sent to every router?
In a more dynamic network approach, you seem (in the issue in github) to be describing a removal procedure, that is triggered by a timeout and then the same mechanism, sending to all routers a removal message?
This would help me get an idea of where to optimize. For instance, reformulating the way connections are stored, maybe transmit the full map in a update as the trade-off for reducing communications.
I like to read mathematical papers on graphs; I found this one about dynamic networks and I'm going to be reading it.
Where did you get your ideas, or where do you think I could get some?
Lyqyd #42
Posted 13 November 2012 - 03:17 PM
We'll use hosts and routers. Routers are a subset of hosts, with additional responsibilities and properties.

Each host, when booting, announces its presence. Each host receiving an announcement sets the gateway and cost for that host to zero (it is a bad idea to attempt to use computer zero as a router for this reason). All traffic directed to nearby hosts is sent directly; routers are only used to communicate to hosts who are further than maximum range allows or that we do not know are within range yet. Each router receiving an announcement transmits its full routing table to that host. The new host, upon receipt of this table, adds paths to all of the hosts in that router's table, unless it already has better routes to those hosts. The router all sends notice of the new host to all routers it knows about (but these routers do NOT update their full list of hosts with this new knowledge at this time) In this way, all routers know about all hosts attached to the network and know how to get to these hosts. Using this method, each host on the network needs only to know which router to send its packets to in order to pass them in the direction of the host it wishes to reach; it does not need to know the full path that packet will take. It does know how many hops it will take to reach that host (cost), so that better routes can be used as they are discovered. In graph terms, each new node is told about connected routing nodes and which nodes may be reached through those routing nodes, but no further information. It may also discover other nodes nearby as they announce themselves.

This does not work as well with turtles, where a route may become invalid (turtle has moved into the territory of another router (this is why the turtle type is tracked separately from computers)), or with computers that are removed from the network (they remain in the routing tables indefinitely, and require a concerted effort to remove fully). The second problem is the issue that the github issue is meant to address, though a correctly formulated fix may address the turtle movement problem as well.

To address some of the strikethrough:
When initializing a network, it may not seem to be created properly until all computers have been restarted (to allow the computers to learn about each other by all of them seeing all announcement packets). That was really all the quoted post was getting at.
CoolisTheName007 #43
Posted 13 November 2012 - 11:32 PM
Thanks for the fast reply!
You did give a lot of intel, on which I elaborate:
So a routing table element consists of a target (identified by ID, name and type, router or non-router ('host that is not a router' is quite long)) and the first router to which a signal must be sent in order to be forwarded to the target, which you call gateway.
So in, the case of an update triggered in router A by an HA packet sent directly by a new host B, A adds the new one edge route to it's routing table, packs an custom (cost updated, ect.) version of it's routing table for B and sends it directly to B, in what it's called a HT packet.
Then it sends( through the gateways it knows, i.e. using the routing table) to all routers, including the ones that aren't directly connected (the gateway field is overwriten as the signal travels, resulting in each router along the way storing the correct gateway), an HI packet that updates the routers with a new route to B. What you mean with:
The router all sends notice of the new host to all routers it knows about (but these routers do NOT update their full list of hosts with this new knowledge at this time)
is that router G receiving an HI packet sends no message to hosts about available targets?
I suppose that the net API automatically rewrites the packet gateway field as they pass through the routers.
Knowing this, in a dynamic network each node is a router, in order to keep maximum connectivity; this can cause lag issues, with this system, as you noted:
This is because only routers will automatically distribute their route table when a computer starts up, to avoid some serious lag issues in dense networks.
I thought about storing routeTable in disk memory to avoid startup lag, but that only deals with server restarts and not the following situation:

Computer B starting up is analogous to moving into range/activating/ect, something dynamic networks should handle well.
In this system, such an event in a dense network/ n computers (routers) in range of each other would trigger: a broadcast of an HA packet +each router R sending an HT packet to B + each router R sending an HI packet to each other router R' = 1+n+n*n~n^2 messages in few ticks. Is this what you meant in the above quote? Or were you just talking about multiple non-routers connecting at startup to one router?

EDIT: I'm halfway through reading the paper I linked. Their idea is to partition the graph in cliques (clusters) (a set of nodes where each node is connected to all of the other nodes in the set), and for each clique choose some boundary nodes, that will act as routers for all the other nodes in the clique. On a node startup or disconnect, they use a series of algorithms to determine an acceptable choice of clusters and boundary nodes, and updates are only sent through boundary nodes. I will complete this later with an analysis of them.
Update: see below posts, I'm now reading content linked from wikipedia.
Lyqyd #44
Posted 14 November 2012 - 07:15 AM
You are correct on the nature of the interaction with HA, HT and HI packets (Host Announcement, Host Table and Host Information, respectively, are the long names for these).

Gateway and cost values are both updated as the packet traverses the network.

The previous startup behavior was for all hosts to acknowledge the new host joining the network, so that it would have full knowledge of local computers. This caused problematic lag even in a single player game, when a cluster of computers would be loaded at once. Changing to having hosts silently update when they receive an HA and only routers pass them a full host table significantly reduced startup lag. Making all hosts routers for a dynamic network would just bring back the old behavior, only worse (since all of them would also send HI packets to all other hosts in the network).

With the advent of distance information (LyqydNet was started before it was available), we have new options. Automatic configuration of hosts into routers based on the physical layout of the network is one possibility, though not necessarily an easy one. I would be interested in seeing workable ideas for an implementation of the clique algorithm for rednet.
CoolisTheName007 #45
Posted 14 November 2012 - 08:45 AM
I'm checking out the wikipedia article on routing: http://en.wikipedia.org/wiki/Routing; it seems a better summary than the first decent article I found; I could classify the method used by the paper as a link-state algorithm confirming my suspicions that calculating and updating the connection graph each update was way too many calculations. EDIT: Although, distance based organising seems interesting…
Maybe the optimized one will be better; as a last resource, one could slow down routing table updates to reduce lag; btw, the classification of LyquidNet would be an 'almost' complete distance vector algorithm (it misses the dynamic update).

EDIT:
-(Fixing excess HI packets):
Also a possible optimization for the current LyquidNet would be making the new host gather the routing tables from it's neighbours, calculating the shortest path to each router R, and sending to the calculated best gateway G a new type of packet, that agglomerates all routers with the same gateway G; for each destination gateway G', in case the routers have different gateways at that step, the package would be split up in two.
What I've just described is also a more efficient protocol to send a packet to different locations (which could be implemented separately).
A consequence of this would be eliminating the excess traffic caused by excess HI packets, but from your recent post I take that sending HT packets from routers to a new host is also a lag-heavy operation.
-(Fixing new node causing too many HT packets being emitted):
Implementing a step by step reception of HT packets?
kazagistar #46
Posted 14 November 2012 - 10:25 AM
What I've just described is also a more efficient protocol to send a packet to different locations (which could be implemented separately).

His code is on github… you can branch it, modify the algorithms, and then send him a pull request.
CoolisTheName007 #47
Posted 14 November 2012 - 10:41 AM
What I've just described is also a more efficient protocol to send a packet to different locations (which could be implemented separately).

His code is on github… you can branch it, modify the algorithms, and then send him a pull request.
(I meant that parentheses not as a request for implementation, but to reinforce the fact that the protocol can be used for more than sending route updates)
I know his code is on github, it's great! You asked some questions to Lyquid in the first page of comments, so I suppose you have your own ideas about this?
I will probably make pull requests after I'm sure of what to code; Lyquid has already put a great deal of work in it's API, and gathered important knowledge about routing with rednet, so I would rather cooperate/get some intel from him, instead of just reverse engineering it.
The problem of running a dynamic network is more complex than the one of a static network, or almost static as LyquidNet is, so just starting coding would be too premature.
Lyqyd #48
Posted 14 November 2012 - 02:18 PM
-(Fixing excess HI packets):
Also a possible optimization for the current LyquidNet would be making the new host gather the routing tables from it's neighbours, calculating the shortest path to each router R, and sending to the calculated best gateway G a new type of packet, that agglomerates all routers with the same gateway G; for each destination gateway G', in case the routers have different gateways at that step, the package would be split up in two.
What I've just described is also a more efficient protocol to send a packet to different locations (which could be implemented separately).
A consequence of this would be eliminating the excess traffic caused by excess HI packets, but from your recent post I take that sending HT packets from routers to a new host is also a lag-heavy operation.

I'm not entirely certain I followed the first sentence. A good fix for HI floods in the all-hosts-are-also-routers scenario is to have the joining host send out all of the HI packets to all of the routers it learns about from the received HT packets, rather than each router sending them out. In the all-hosts-are-also-routers scenario, this means n packets rather than n2 packets. This has the problem of not discovering the best path to the host necessarily, but instead a workable path to each host. It may be possible to construct a scenario in which this method creates a multiple-hops-longer-than-necessary route, which I don't consider a good tradeoff. I think that an all-hosts-are-also-routers networking API would need to be specifically designed around that fact.

-(Fixing new node causing too many HT packets being emitted):
Implementing a step by step reception of HT packets?

Not sure what you mean here.
CoolisTheName007 #49
Posted 15 November 2012 - 01:05 AM
I stand corrected, my HI packets fix was incomplete. As for the rest:
I mean that in order to reduce traffic flow caused by too many nodes sending their HT tables to the same new host, one could devise a protocol to slow down or parse the process in lag-relative smaller steps. I agree that a dynamic network API would have to be it's own thing, mainly due to the extra load it may cause; in general one would like to have control over how dynamic and how static a network is.
I'll finish reading the articles on the protocols defined in Wikipedia before posting more. Right now, I'm reading http://ccrg.soe.ucsc....dual.ton93.pdf linked from http://en.wikipedia.org/wiki/EIGRP.
wilcomega #50
Posted 15 November 2012 - 05:29 AM
i suggest you making a installer that downloads all the stuff for you. because i do want to use this but not download all those programs. and can i install it on every computer apart or do i have to put it in the lua folder?
Lyqyd #51
Posted 15 November 2012 - 07:43 AM
i suggest you making a installer that downloads all the stuff for you. because i do want to use this but not download all those programs. and can i install it on every computer apart or do i have to put it in the lua folder?

I will probably make an installer for it at some point in the near future. My main focus right now is work on stuff for LyqydOS. Installing it on each computer will be fine, as long as you make sure to load the APIs (net, connection, netfile) before starting anything else from LyqydNet.
wilcomega #52
Posted 15 November 2012 - 11:24 PM
ok nice, i suggest you making a secure connection. that one is encrypted with a random password maybe?
Lyqyd #53
Posted 16 November 2012 - 04:08 PM
I haven't seen any good encryption implementations entirely in Lua, certainly nothing that I would trust to be an integral part of the system. Apps using LyqydNet could always use their own encryption on their messages, if desired. LyqydNet doesn't care at all what the message itself contains, so encrypted or plaintext will work just as well.
Sukasa #54
Posted 22 November 2012 - 04:25 PM
I've been trying to set up a basic network, but so far my attempt has been stymied by a crash in net

I get the error
net:185: attempt to index ? (a nil value)
after connecting the first host to a two-router network in SMP.

I am using Railcraft World Anchors to ensure both routers are loaded. The first router has the computer label "_COREROUTER," and is placed near the server spawn. The second router is "_EDGEPOINTROUTER", and is roughly 2000 blocks away. Before trying anything, I ensure that all three computers are off and that their Rednet modems are not enabled. When I start up the Edgepoint router first and then the spawn router, everything seems to work fine. netmon on the spawn router shows the line
13: HT:4,4;13:0,0;R _EDGEPOINTROUTER> @ 1358.1178

I then start up the (only) host on the network, SpawnTerm, which is also at spawn. If I then go back to _COREROUTER and check netmon's output, this is what I get:
CraftOS 1.4
13: HT:4,4;13:0,0;R _EDGEPOINTROUTER> @ 1358.1178
12: HA:4,4;C SpawnTerm @ 60.967205
13: HI:4,4;12:13,1;C SpawnTerm @ 1358.1178
net:185: attempt to index ? (a nil value)

I poked into net and found that the line in question is
if routeTable[routeNum].gateway ~= 0 and dist then
I changed that to
local r_test = routeTable[routeNum]
if r_test.gateway ~= 0 and dist then
and found that the problem is that routeTable[routeNum] is apparently nil.

On SpawnTerm, the hosts file is the following
7:13,1:R nil

Am I setting the network up wrong somehow, or could GPS hosts (running the default GPS daemons that come with CC) be interfering with lyqydnet?

EDIT: After working at this some more, I've found a bit more information.

Seems packet_recieve mangles the message somehow, and instead of returning something useful returns nil. I added some debug code to display the contents of message, id, dist, and what message was before packet_recieve() was called. The output I got from that is this:
ERROR: NIL ROUTE
MSG NIL (the variable message is nil)
ID: 13 (The ComputerID of _EDGEPOINTROUTER)
DIST: 1358.1178
ORIG: HI:4,4;12:13,1;C SpawnTerm (The string passed to packet_recieve())
Lyqyd #55
Posted 23 November 2012 - 04:51 AM
I have a sneaking suspicion that this is a bug I've solved downstream of the master repository (I believe the develop branch on github is free of this issue). Thank you for the excellent bug report; I shall be sure to investigate this evening.
Sukasa #56
Posted 23 November 2012 - 09:43 AM
If more content, such as the world or configuration files would assist in debugging, I'll be happy to supply these. Also, this problem occurs in SMP. I have not tested this in SSP.
Lyqyd #57
Posted 23 November 2012 - 11:57 AM
Okay, I think I've got it solved. If you could re-download the net API file and re-test adding a new computer in the same way, that would be much appreciated. I had apparently forgotten to special-case HI packets in the same way as HA and HT for new computers joining the network, which was the source of the problem. The latest revision should solve that issue.

Thanks again for the awesome bug report!
Sukasa #58
Posted 23 November 2012 - 12:26 PM
My pleasure. I've updated to the newer net, and the error is not occurring anymore. Unfortunately, I have a new issue for you.

It's quite the edge case in this instance, but I found a problem when using a "routers on towers, hosts on the ground" setup. Since hosts (on my server) have only a transmit range of 256 blocks at ground level, but routers are high enough to have a transmit range of nearly 2000 blocks (as per my config), there's a specific error that's possible.

Since it's the range of the transmitting modem that determines whether a packet is sent or not, it's possible (and in my case, I think has happened) that a host might avoid transmitting through a nearer router (that it can transmit to) in favour of a more distant router it cannot reach. Such an issue is showing up on my server, where I have two hosts and two routers. The routers are around Y 200, so they have a massive transmit range. The hosts are around Y 64, so their range is only a few hundred blocks. The problem I have is that the two hosts have valid routes if they cross both routers, but they see their more-distant router as the preferred route (as the route packet from that router reaches the host) instead of the nearer route with a slightly higher hop count.

The gist of the issue is that the hosts are trying to route packets through routers they cannot reach, instead of transmitting to a nearer router they can reach, because there is no confirmation that a link is two-way when establishing routes - the hosts get a packet from the router, and mistakenly assume that because they can hear the other party, the other party can hear them.

In my case, I plan on just changing transmit ranges so that they're even throughout the server independent of altitude for the time being, as a work-around.
Lyqyd #59
Posted 23 November 2012 - 12:52 PM
That's interesting. I'd have to play around with that a little bit, because as far as I am aware, the determination of whether a packet from one computer to another is based on the larger of the two ranges, such that any computer within the very large range of a high-up computer can communicate with it in both directions, even though its (shorter) range wouldn't normally allow it to. If that's not the case, it certainly brings up a sticky problem, since the range of the computer isn't really knowable.
Sukasa #60
Posted 23 November 2012 - 08:32 PM
Just as a thought, what about a simpler 'prefer longer routes, if the router is geographically closer'? If a host can get onto the network at all, then it's guaranteed that at least one router is within range of the host. Therefore, one solution (albeit not the best) is to provide a way for a host to prefer a longer route, if the first hop in that route is closer than the current 'fastest.' It bypasses the issue of not knowing your transmit capabilities and would definitely improve network resiliency at the expense of some efficiency.
CoolisTheName007 #61
Posted 24 November 2012 - 11:18 AM
EDIT:this discussion is being continued in this topic:Networking - Towards a complete solution

Some info: it seems that there is quite a lot of academic work about what is called geographic routing, i.e. routing when the position of hosts are known. I will complete this post with more details later.
UPDATE: Reading this. They propose several memory-less algorithms, the base idea is:
-reroute message to neighbors nearer to the target than the host; if not possible then perform a certain type of random walk until a host nearer to the target is found, and repeat. How the random walk is performed is where the magic lies, and that's what I'm deciphering now.
UPDATE: for using CC's shifting range,there may be some kind of transformation that would allow to treat the range as fixed. Quite selfishly, I start to dislike the variable range.
UPDATE: their algorithm limits it's update sequences to 3 hops of distance + #neighbors, and limits the memory needed in each transmitter. However, they don't specify any on_failure or on_boot behavior, which is what I'll be thinking about.

PS: Any word on the high range being one way? Cause that is a game changer
EDIT: apparently it's both ways, otherwise GPS wouldn't work.

UPDATE: finished reading and understanding the article; plus started looking into Babel, which is somehow like Cisco Systems algorithm. It is also a distance vector algorithm, but with a lot of tweaks.

UPDATE: After researching a lot, I believe the following protocols will cover most networking needs on CC:
- Babel Protocol (BP): an advanced distance vector dynamic protocol, with configurable update speed, documented, and implemented in C; with simplifications regarding to the fact that we only use one interface, rednet, which fortunately have already been studied here; aliases such as labels also are something that would have to be put in.
–EDIT: a possible improvement would be limiting broadcasts to starting up hosts and routers;
- a 3D greedy-random-greedy geographic routing protocol (GR), for fast changing networks such as a crew of turtles.

In general, one would need an API/abstract class that would enable communication between different kinds of networks; a request to this API would have as arguments a tuple (message, target ID, network ID).
-each computer can be present in several networks;

-independently of the protocol implementation, using coroutines one can easily make several protocols coexist in the background; but it would be preferable to provide a step function for the network processes;

-a network has a protocol and it's own separate variables; this means that, for maximum efficiency, protocols API's must be able to generate several network instances without conflicts; then again one can just reload the file in a separate environment and start a new network from there;

-network ID's would exist to enable separation of different purpose networks or even players network's, as in:
-simple agreements to not use the same ID
In case that's not enough:
-creating network ID specific white-lists, e.g. anyone connecting to network N must be on a pre-defined whitelist associated with N;
-equiping a network with encryption:
Note that encryption is only necessary when performing broadcasts, an essential feature of self configuring networks, and that shipping the API with a default encryption would preserve easy setup.
first idea: any kind of encryption that relies on a constant and/or cyclic (that repeats after a reasonable game time-scale) process to generate and synchronize an encryption key (e.g. combinations of a user entered key + os.time) is unsafe, because it is only needed to intercept a broadcast (e.g. a catastrophic one would be an hello signal), wait some time and repeat it. Unfortunately for the hacker, broadcasts in networks are used for neighbor discovery only; even if someone managed to get the right message and repeat it each minecraft day at the same interval of some seconds, the network would repair itself after a while (both in the case of BP and GR). But what about other broadcasts?

second idea: each rednet message contains the sender ID (in retrospect, this is quite a violation of the sandbox and virtual experience, but I'm grateful for it).
Say A wants to send M to B, and C is a malevolent computer listening to their communications. Also, assume both A and B share an encryption method, where decryption is D and encryption is E, that has the following property: it is very hard to replace m1 in M'=E(m1..separator..m2) by m3, knowing only m1 and M', where .. is string concatenation, mi's are strings and separator is a fixed string. IMO both private and public key methods that follow this condition should exist already. Then, A sends to B the message E(id(A)..separator..M). B decrypts it and only accepts the message if the id in the message matches the sender ID. C can't easily replace the id in the message by it's own, so we have a safe system!!!
EDIT: I've found a Lua implementation of RC4. Albeit it's the worst in security, apparently it's great for software. SECOND EDIT: Nope, won't work with a fixed key. But I do think that using the id's is the right thing.
THIRD EDIT: A more concise formulation of the most basic security (first router is trusted) is:
What would you do to ensure that B, via broadcasting, informs A of it's existence and certifies itself as belonging to the same permission group as A, without enabling malevolent computer C to do the same? (C knows both the ID's and general programs that A and B are running, but A and B can share a private key previously set). The main interest is that the key is not a white-list, though probably one could update one over the network as needed.
Take in account that an efficient algorithm is preferred.
This should be enough to allow for extremely safe transmissions in dynamic networks (see LyqydNet) , if you trust the routers in between.

For now:
-Babel protocol;
-Geographic routing protocol;


I still don't know how to model host to network /host to network to host (see a pattern?) communication. Here's a sketch.
- a to be designed protocol (NRP) to deal with non-routers (NR) intercommunication;message acknowledgement (thanks gmt2001 for the vocabulary), would be made at this level, if necessary.
Router side:
-router A can send over BP commands to NRP on other routers, e.g. router B, such as:
1-send to a certain NR believed to be connected to B a certain message; this requires no knowledge whatsoever about connected NR's.
Opposed to that, we have special tables for storing
2-send to B an update about certain or all NR's connected to A; B would store those as a (NR,A) pair.
NR side:
a-sending controls to the router side;
b-message and handshake: send message M to target T, target replies with a confirmation and we are done.
c-updating neighborhood:
c1- listens to hello signals; may be slow;
c2- broadcasts a hello, and waits for 'I heard you' replies; then it creates it's own direct NR's/R's list.

Loose notes:
-high traffic server restarts can be dealt with by saving to disk stable routing information,i.e. Babel would save to disk but geographic routing wouldn't need to, since it generates less traffic.
PS: no full editor -&amp;amp;amp;amp;amp;amp;amp;amp;gt; no links, no indentation
gmt2001 #62
Posted 27 November 2012 - 07:35 AM
This topic is starting to make my head hurt

communication handshake (not sure how to call it, basically making sure the message reached the target), would be made at this level, if necessary
Would Message Acknowledgement be what your looking for?
CoolisTheName007 #63
Posted 27 November 2012 - 08:12 AM
snip
Thanks for the interest! In order to simplify stuff and get something new done, I've started to think how to do a general purpose framework for networking.
See the edit on my last post.
Lyqyd #64
Posted 05 January 2013 - 10:04 PM
I've added basic route invalidation in cases where routed packets were not acknowledged by the receiving host. This seems to work quite well, but testing is not necessarily complete at this time. This update has been pushed to the main repo, so it's available if you'd like to play around with it.
electrickite #65
Posted 10 January 2013 - 06:13 AM
No hard modification of the ROM files is necessary to run this.

Can you provide any guidance on how to install this on an SMP server without modifying the ROM files? The APIs could be included in the startup file, but I'm not sure what to do with the programs folder. How would I get the reboot/shutdown/exit programs to work? Thanks!
PaidLeber #66
Posted 13 January 2013 - 07:55 AM
downloaded the latest copy of the repo from github.. installed to .minecraft/mods…etc once I start the world, I get the following from all routers and turtles that load up the api on reboot:

net:189:bad argument: string expected, got nil
Press any key to continue..

The api worked fine the last pull that I did (about a week ago). I redownloaded the api to get the routerDaemon updated.
PaidLeber #67
Posted 13 January 2013 - 08:01 AM
Ahh.. looks like I pulled from the wrong branch..
Lyqyd #68
Posted 13 January 2013 - 09:34 AM
No hard modification of the ROM files is necessary to run this.

Can you provide any guidance on how to install this on an SMP server without modifying the ROM files? The APIs could be included in the startup file, but I'm not sure what to do with the programs folder. How would I get the reboot/shutdown/exit programs to work? Thanks!

The reboot/shutdown/exit programs (as well as the other programs it comes with) could all go in the root of the computer's drive. Then, when you type reboot, it'll find the reboot program in the root of the drive first and run it instead of the reboot program in rom.

Ahh.. looks like I pulled from the wrong branch..

Hope you got it resolved, then! Let me know if you have further troubles with it.
PaidLeber #69
Posted 13 January 2013 - 10:53 AM
My issue is that I'm not observing any routing behavior from the routers. Here is my setup:

I have a client computer that opens a connection and sends a vector to a turtle's background server. The turtle then moves to that location using your locationapi. Works great within ~64 block radius. After about 64 blocks I can't open a connection to the turtle (i.e.default computercraft.cfg modem_range=64 value). Fine… so I added a lyqydNet router with a simple background server at 254y blocks up "satellite" from the client computer in creative mode.

From the satellite computer, I can open a connection to the turtle or the client computer. From the turtle or client computer, I can open a connection to the satellite router… but I can't get routed packets to the satellite then to the turtle.

I've also tried placing a router ~32 blocks between the client computer and the turtle, but still no luck.


client and turtle startup is:

shell.run("modread")
shell.run("netd")
net.netInit()


shell.run("turtlenav")


satellite and middle router startup is:

shell.run("modread")
shell.run("netd")
shell.run("routed")
net.netInit()

Host discovery works fine as far as I can tell.. I can see all the hosts and routers in the etc/hosts on all systems. Is there anything else that I'm missing?
Lyqyd #70
Posted 13 January 2013 - 12:08 PM
Yikes! Turtle routing is a bit of a nasty spot, still. Once a host has a cost of 0, the routing table is highly unlikely to ever pick up a further route for it (this is planned to be fixed, but hasn't happened yet). You could try grabbing the net program (not to be confused with the net api!) and run "net route flush", which should clear the routing table on the host and allow it to pick up the turtle's correct route after it reboots.
PaidLeber #71
Posted 13 January 2013 - 02:46 PM
It works to an extent, but is still pretty awesome!

Just as future record, I have to "net route flush" and reboot both endpoints (computer and turtle) to get the connection (leave the satellite router alone). If the turtle stays out of the 64 block rednet limit there are no issues.

Once the turtle comes within range of the control computer however, the control terminal will update it's routes back to the shortest hop.

Maybe in the future, allow the user to hard code a route?

If I made actual etc/hosts file read only… would that stop the client from updating its routes? I'll give it a try.
Edited on 13 January 2013 - 03:23 PM
Lyqyd #72
Posted 14 January 2013 - 07:22 AM
Well, the plan is to have the system that detects undelivered packets that have gone through a router also handle packets on peer routes, so that they can be updated automatically regardless.

Glad you've found the API useful aside from the slight issue with turtles! I'll try to set aside some time soon to fix that. :)/>
vcordie #73
Posted 12 February 2013 - 04:24 AM
*snip*
This does not work as well with turtles, where a route may become invalid (turtle has moved into the territory of another router (this is why the turtle type is tracked separately from computers)), or with computers that are removed from the network (they remain in the routing tables indefinitely, and require a concerted effort to remove fully). The second problem is the issue that the github issue is meant to address, though a correctly formulated fix may address the turtle movement problem as well.
Is the fix for the turtle movement problem a high priority, or would you have to redesign the api to use a geographic routing protocol like this guy suggested in order to get turtles to work well with a long range rednet routing network:
*snip*
UPDATE: After researching a lot, I believe the following protocols will cover most networking needs on CC:
- Babel Protocol (BP): an advanced distance vector dynamic protocol, with configurable update speed, documented, and implemented in C; with simplifications regarding to the fact that we only use one interface, rednet, which fortunately have already been studied here; aliases such as labels also are something that would have to be put in.
–EDIT: a possible improvement would be limiting broadcasts to starting up hosts and routers;
- a 3D greedy-random-greedy geographic routing protocol (GR), for fast changing networks such as a crew of turtles.
*snip*
The ability to use a combination of this API and GPS hosts to set up a group of chunk loading turtles to A.
Automatically build a combined router+gps satellite network that serves and fits inside one or multiple chunks
B. Use pathfinding api already available on this forum to send mining turtles (with enderchests) to these chunks and quarry quarry quarry
C. report to a main computer how much each turtle has mined, their current fuel level, and their current location, to manually extract turtles who are just out of fuel and done

A proper gps+networking API that has turtle support can allow, with some fancy programming and the use of other apis, the ability to automatically set up turtles who go out on their own, and mine.
Or networks that automatically set themselves up in new areas
Or instead of mining turtles, how about building turtles
Or mapping turtles
Flower picking turtles?
The possibilitys are endless, heh.

</endrant>
Lyqyd #74
Posted 13 February 2013 - 07:25 AM
*snip*
This does not work as well with turtles, where a route may become invalid (turtle has moved into the territory of another router (this is why the turtle type is tracked separately from computers)), or with computers that are removed from the network (they remain in the routing tables indefinitely, and require a concerted effort to remove fully). The second problem is the issue that the github issue is meant to address, though a correctly formulated fix may address the turtle movement problem as well.
Is the fix for the turtle movement problem a high priority, or would you have to redesign the api to use a geographic routing protocol like this guy suggested in order to get turtles to work well with a long range rednet routing network:

No re-design required, just a little bit of tricky changes in the routing daemon, and possibly a little new code in the net API. I'll see if I can set aside some time soon to implement this.

I removed the idiotic post about necromancy and your reply to it, by the way. This project is certainly not dead. :)/>
vcordie #75
Posted 13 February 2013 - 09:56 AM
Good to hear, huzzah!
Nikki #76
Posted 04 March 2013 - 06:07 PM
This is pretty amazing, I've been surprised by ComputerCraft a few times in the month of using it, this is one of the few times I've just been blown away by the possibilities, I can't really think of a use for it right now, but it's nice to know it's always there :D/>
shiry #77
Posted 07 March 2013 - 03:56 AM
I've been trying this cool API out but i can't seem to get it to work :(/>

Here is my testing code

When running the client the function "connection.awaitResponse" keeps crashing with "connection:170: attempt to index ? (a nil value)

client:


shell.run("modread")
shell.run("netd")
net.netInit()
serverConnection = connection.open("testserver", 21, 2)
if not serverConnection then
print("Failed to connect")

else

while true do
write("message: ")
input = read()
connection.send(serverConnection, "data", input)
messageType, message = connection.awaitResponse(serverConnection,60)
print("Recieved: "..message)


end 
end

server:

shell.run("modread")
shell.run("netd")
net.netInit()
local connections = {}

while true do
conn, messType, message = connection.listen(21)
if connections[conn] and connections[conn].status == "open" then

if messType == "data" then
connection.send(conn, "data", "did you say: "..message.."?")
end
elseif messType == "query" then

if connections[conn] then
connections[conn].status = open
connections[conn].name = connection.name(conn)
else

local connect = {}
connect.status = "open"
connect.name = connection.name(conn)
table.insert(connections, conn, connect)
end
connection.send(conn, "response", "ok")
end
end


I have been trying to go through your code to see whats up but its rather large and I figured i might not be the first to run into this problem.

Also I am running computercraft through the newest version of tekkit light

EDIT: Okay I got a bit further apparently the connection is never made i updated client and server test code, however the connection is still failing.
Can it be because I am supposed to set server name somewhere?
Edited on 07 March 2013 - 03:24 AM
Lyqyd #78
Posted 07 March 2013 - 05:20 AM
Is your server computer's label set to "testserver"? I will look into this and see if I can duplicate the bug.
shiry #79
Posted 07 March 2013 - 07:51 AM
Is your server computer's label set to "testserver"? I will look into this and see if I can duplicate the bug.

Hmm no i didn't but doing so didn't fix my problem :(/>
shiry #80
Posted 08 March 2013 - 12:20 PM
Is your server computer's label set to "testserver"? I will look into this and see if I can duplicate the bug.

Were you successful in duplicating the error?
Lyqyd #81
Posted 09 March 2013 - 07:17 AM
Sorry, I've had quite a bit going on IRL recently. I haven't had a chance to sit down with the code and figure out what's going on just yet. I should have a chance to do so this weekend or the following week. Just to confirm, you are using the latest version of the master branch of LyqydNet from the github, correct? Knowing which version you are using will drastically speed things along when I do poke through it.

Also, if you could make sure that both computers are labelled, that would be great. And since the labels are used when attempting to connect to a computer by name, make sure that the label you are using matches the name of the computer that you're telling it to connect to. :)/>
Lyqyd #82
Posted 17 March 2013 - 04:57 PM
Is your server computer's label set to "testserver"? I will look into this and see if I can duplicate the bug.

Were you successful in duplicating the error?

Well, I was unsuccessful in duplicating the error. I ran your code exactly, on a correctly set up LyqydNet network, and it ran without issue. :)/>

If you're having trouble getting it to connect, make sure that all of the computers in the network are labelled. It may help to have a computer dedicated as a router. You've got the startup for each computer set up correctly as far as I can tell, so the labelling is the only issue I can think of. Let me know if you are still having issues and I can take a look at a world save if you're willing to upload one someplace. :)/>
Timendainum #83
Posted 23 November 2013 - 11:43 PM
I am using this API in conjunction with a slightly modified version of Lyqyd's filesserver to automate software updates on a computer network.

When I call sequential netfile.put() calls they fail, and it seems like I have to sleep() some to allow the next file to be sent.

Below is the function I am using. I think what may be happening is the last network transaction is not completed yet, therefore this one is failing, but I'm not sure. It is down in the net API where the it is failing at though.


local function pushUpdateToServer(serverLabel)
	--test for updating self
	if serverLabel == os.getComputerLabel() then
		print("Cannot push to self. Skipping " .. serverLabel .. ".")
		return
	end

	-- declarations
	local serverConnection = false
	local remoteDir = false
	--read files config
	local files = config.readConfig("/etc/files")
	
	--open server connection
	serverConnection, remoteDir = connection.open(serverLabel, port, timeout)
		if not serverConnection then
		print("Connection to " .. serverLabel .. " Failed!")
		return
	else
		print("Connected to ".. serverLabel .." Path: ".. remoteDir)
	end

	-- loop over files list and update files
	for k, v in pairs(files) do
		local path = shell.resolve(str.replace(v[1], fs.getName(v[1]), ""))
		local fullPath = shell.resolve(v[1])
		--try to create remote directory
		-- (this will happen a lot, may want to detect for it and create it conditionally)
		if path ~= "/" and path ~= "" then
			print("Sending mkdir " .. path)
			connection.send(serverConnection, "fileMakeDirectory", path)
						remoteDir = gatherResponse(serverConnection)
			print("Response: " .. remoteDir)
		end
		-- put the file
		write("Sending file: " .. fullPath .. " ")

		local success = false
		local retrys = 1
		while not success do
			write("..try" .. retrys)
			success = netfile.put(serverConnection, fullPath, fullPath, timeout)
			if retrys > 3 then
				break
			end
			
			if not success then
				retrys = retrys + 1
				sleep(1)
			end
		end
		if success then
			print("..success.")
		else
			write("..failed. <CR>")
			local junk = read()
			return
		end
	end

	--close server connection
	if connection.close(serverConnection) then
		serverConnection = false
		print("Connection Closed.")
	else
		print("Could not close connection!")
	end
end

You can see I've put in a retry system. It always seems to work on the second try.

Does anyone have any ideas on how I can improve this?
Edited on 23 November 2013 - 10:46 PM
Lyqyd #84
Posted 23 November 2013 - 11:58 PM
Have you tried specifying a timeout value? Try a second or two to actually give the server a chance to respond.
Timendainum #85
Posted 24 November 2013 - 12:46 AM
Have you tried specifying a timeout value? Try a second or two to actually give the server a chance to respond.

Yeah, that was my first thought as well. I have tried setting the timeout to as high as 60. I have set the sleep time to as low as 0.01 and it works every time.

full script is here:
https://github.com/Timendainum/Wintermute/blob/master/opt/netupdate/push.lua
Edited on 03 December 2013 - 04:02 PM
Lyqyd #86
Posted 24 November 2013 - 03:38 AM
I've added an issue to the tracker on Github for LyqydNet for this problem. I'll work on this as time allows, hopefully I'll be able to take a whack at it soon.
Timendainum #87
Posted 24 November 2013 - 03:58 PM
Ah, okay. I totally expected it was something i was doing wrong.

I'm also working on a network peripheral Api and daemon. I may have some questions for you later this evening.

This Api is very cool. I've been having a lot of fun playing with it.
Timendainum #88
Posted 26 November 2013 - 06:28 PM
While writing my wireless peripheral API

API
http://pastebin.com/APNEz5BY

daemon
http://pastebin.com/XhaDnyZ8

I've noticed similar behavior with successive connections. I've had to put a sleep in before the connection to make sure successive connections will work.
Lyqyd #89
Posted 05 July 2014 - 05:32 AM
I've pushed my more recent progress on this from the development branch on the github repo over to the master branch. If anyone runs in to any issues with it, feel free to post them here or as issues on the github. Note that this is a rather big change, and scripts for previous versions of LyqydNet will be broken. This should be the last time I institute major breaking changes, as the overall API design is much better at this point. Most (if not all) functionality should still be there, and there are a couple things that work better than they previously did.
Spartan_MiniMe #90
Posted 08 July 2014 - 02:04 AM
I am quite confused on how to install this. I have added all the api files to computercraft1.57.zip/assets/computercraft/lua/rom/apis and all the program files to computercraft1.57.zip/assets/computercraft/lua/rom/programs. However, when I attempt to run a computer as a router with

shell.run("lyqydnet")
shell.run("routed")
i get these outputs

File not found
File not found
File not found
File not found
File not found
SI
SI
I'm not sure if a installed it correctly… any help would be appreciated!

I put them in a code tag because i don't know how to put an image into the post.
Spartan_MiniMe #91
Posted 08 July 2014 - 02:55 AM
Oh, never mind! I hadn't read the
No hard modification of the ROM files is necessary to run this.
Lyqyd #92
Posted 06 October 2014 - 05:12 AM
I've been spending a bit of time on this API this weekend, and I've pushed my work to the github repo. The majority of the work was resolving some longstanding issues of multiple packet processing passes, as well as updating to 1.6+ packet structures and concepts. I believe I've maintained backwards compatibility on the vanilla rednet side, so you should be able to use this with essentially all versions of ComputerCraft since tables were first allowed to be sent as rednet messages. The changes that made LyqydNet vastly better back in July did mean that versions that only allowed rednet to transmit strings would no longer be supported, and that has not changed. This version has been tested to work both with and without LyqydNet. I've been testing nsh and have successfully used it between two computers using LyqydNet as well as between a computer using LyqydNet and a computer not using LyqydNet. I believe I have the compatibility issues sorted out at this point.
tec_SG #93
Posted 03 November 2014 - 08:18 PM
Just one question, what way would be the best one to implement "turnOn()" for non-reachable routers/hosts (connected via LAN cables), so the network stack can try to send the data afterwards?

Afaik it will require pairing (multiple) Modem names with computer ID.
Edited on 03 November 2014 - 07:22 PM
Dragon53535 #94
Posted 03 November 2014 - 09:57 PM
When you say non reachable you mean ones where you have no idea what the name is?


local modem = peripheral.wrap("right")--#Assuming your modem is on the right.
local function turnOnEveryone()
  for _,i in pairs(modem.getNamesRemote()) do --#getNamesRemote grabs those peripheral names that you can't get, however through the wire.
	  if peripheral.getType(i) == "computer" then --#If the peripheral is a computer. This is in case you've got monitors and whatever connected
	    peripheral.call(i,"shutdown") --#Turn them off
	    sleep(0)
	    peripheral.call(i,"turnOn") --#Turn them on
	  end
    end
end
Lyqyd #95
Posted 03 November 2014 - 10:04 PM
That's an interesting question, actually. Within the context of LyqydNet, I think the easiest way to implement such a feature would be to force on packet receipt acknowledgement for all packets (which is a simple change, but would nearly double rednet traffic), then when a packet fails to be acknowledged, use existing host querying methods, but also iterate all available computer peripherals, checking the ID number against the ID the packet was intended for. If the correct computer is found, the turnOn() call would be made and the packet could be retried after a short sleep to allow it to initialize.
tec_SG #96
Posted 04 November 2014 - 08:24 AM
Or just pre-send turnOn() to the desired pc if it is on the network and then send the packet, afaik turnOn() does nothing if the pc is On. (startup doesn't trigger)

Still idk if there is a method to get names of the "modems" (like "computer_##" since they are not per PC) connected to a PC(locally) without the need of other PC and data transfer, or just inputting the ## numbers manually.

EDIT:
preferably it can be done easily with
computer.getID() call per every modem-PC in the network and then just send turnOn() to matching pair

EDIT:2
Is net.raw_send() used for both router-router and router-host communication.
Noticed only one hit for "transmit" so this is true

EDIT:3
So i did this: (from "net")

TurnOn_Packet=TurnOn_Packet or TurnOn_Broadcast or false
TurnOn_Broadcast=TurnOn_Broadcast or false

function raw_send (recipient, message, forceOn)
if forceOn or TurnOn_Packet then
  if recipent==65535 and (forceOn or TurnOn_Broadcast) then
   for _,v in ipairs(peripheral.getNames()) do--list peripherals
    if string.find(v,"computer_") then --if computer
	 pcall(peripheral.call,v,"turnOn")--turn on
	 --pcall in case something gets changed when iterating
	 sleep(0.1)
    end
   end
  else
   for _,v in ipairs(peripheral.getNames()) do--list peripherals
    if string.find(v,"computer_") then --if computer
	 t,PC=pcall(peripheral.call,v,"getID") --try to get ID
	 if t and PC==recipent then --if id OK
	  pcall(peripheral.call,v,"turnOn")--turn on
	  --pcall in case something gets changed when iterating
	  sleep(0.1)
	 end
    end
   end
   pcall(peripheral.call,"computer_"..recipent,"turnOn")
   sleep(0.1)
  end
end
peripheral.call(modemSide, "transmit", recipient, os.computerID(), message)
end

And if I'am right this should allow the packet to turn on the desired pc if the correct flag is on, but still my point is to add configs allowing to:

1: turn on routers that are needed to forward a packet
2: turn on host that is the recipent
so it would :
-not turn on computers not needed in the process
-not turn on computers just for network discovery (finding/checking routes)

and another flag to allow turnOn broadcasts (so i can send data to everywhere without turning the computers on manually)

So i ask for the features above to be implemented, since finding every send, and raw_send instance in this api without it deep knowledge and appending this configs by me would probably end with just making it "bORkeD"
Edited on 04 November 2014 - 07:14 PM
Lyqyd #97
Posted 05 November 2014 - 05:28 AM
It's an interesting request. I have to ask, though. Why on earth are you expecting computers to be normally off? I've never encountered anyone else keeping their computers off all the time. Everybody I've talked to just leaves all of them on, or at least all of the infrastructure they've set up. I'm a little reluctant to add a feature that only one person (to my knowledge) would ever need. Maybe if you could further expound upon the reasons for keeping them turned off, I could better understand why you want it.
tec_SG #98
Posted 05 November 2014 - 06:11 AM
SMP reasons, chunk unload/server restart-> PCs are going off.
Edited on 05 November 2014 - 03:38 PM
Lyqyd #99
Posted 05 November 2014 - 05:39 PM
Oh, that's actually a bug in the version of ComputerCraft you're using. The latest version doesn't have that bug.

I'll think about the feature request a bit more, though.
tec_SG #100
Posted 05 November 2014 - 07:31 PM
Tested it on CC 1.65 + Cauldron server, seems you are right sir. That should accelerate my programming sine the problem is solved at some point
.
But still it would be nice to have that functionality, for backwards compatibility, and for applications like redstone impulsator where you do not need the pc to be on all the time.
theoriginalbit #101
Posted 05 November 2014 - 11:29 PM
Cauldron server
this could be 99% of the problem right here with the older versions.
tec_SG #102
Posted 07 November 2014 - 07:59 PM
Cauldron server
this could be 99% of the problem right here with the older versions.

I confirmed that it saves the state of the pc on cc 1.65 +cauldron, just as he said the latest version does not have that bug so neither do I.
Lyqyd #103
Posted 11 December 2014 - 05:49 PM
I've added a couple new features.

Back when LyqydNet was first created, there were only wireless modems. Thus, LyqydNet as designed for only a single modem per computer–there was no need for additional modems. I've just added interface (side) information to the routing tables stored by LyqydNet, as well as enabling support for more than one modem per computer. The system will automatically select the best modem to send a message to a known host. Routers with more than one modem can route messages between networks. You could, for instance, have a wired network in your base and use wireless routers to link to a distant base. Non-router computers that are on two different networks will not repeat packets originating in one network on the other.

The second feature is support for some of the newer rednet networking concepts. LyqydNet routers will now act as if they are running the default "repeat" program as well as routing messages as normal. With the rednet API overrides included in LyqydNet, rednet messages to known hosts will be routed with the less chatty LyqydNet routing, while unknown or non-LyqydNet hosts will be reached via the default rednet repeating methodology. I also plan on implementing the rednet style DNS lookup functionality soon.

As usual, if you find any issues, feel free to post them here or on the github repo!
Elsys656 #104
Posted 19 March 2015 - 07:08 AM
How would I go about implementing my PKI in nsh for an implementation of psudo tls I already have the encryption/decryption algorithms figured out basically it's not a true private/shared key but more like a web api key in which theirs a private hash key encrypted and stored on a server with a public hash key that decrypts that key the uses the private key for validation the encrypted form is sent to the client which decrypts it using their copy of the private key and sends the decrypted private key back to be checked against the server's copy of the decrypted private key.

If all of these factors are proven true and your routing api basically solved the problem of validating clients(I was previously using a combination of gps and computerID as a psudo ip address if the location is the same as the one stored in the clients trusted servers file then it's valid it requires a user to validate the request the first time before we have a profile for that server etc.)

on serverside if the key sent matches its copy of private key and the generated client profile based on computer id each computer id has exactly 1 tls key the keys are generated serverside only and only the public key is issued to the client and never transmitted it must be manually input into the configuration file of the client.

if every one of those factors are true then the server uses a random time seed based on %d%d%d all the minecraft time values to generate unique keys with each request and send those keys along with the packet (Basically the way actual ssl works with the exception of true private/public cryptography in which at no point does the private key in any form leave the server since they encrypt/decrypt each other. Wish I knew a bit more about how to port code to lua to get a rudimentary real AES pki ("same as openssl") since the seed function in lua is an openssl supported one.

Anyway I tried using your nsh to do this but I can't seem to get my nsh client computer to send any sort of request to the server to go through the auth process/notify the server that your remote and want to create a profile.

The cryptography works fine from the server and the server validates the generated password(I just want more than one password or more than one "user", one for each device that connects to the shell might set up a kind of jailing too eventually)

How would I encrypt all traffic like this regardless of what it is at each endpoint decrypt and pass that on to an isolated network behind the router passing the key around till it gets regenerated by the authentication server? Will it keep people from spoofing packets yep. Will it keep people from generating a way of decrypting all packets on the network yes. Could they monitor realtime traffic of a single connection and decrypt that unfortunately yes that's possible if theirs a way of spoofing hostnames.
Abahu #105
Posted 17 May 2015 - 05:08 PM
I'm glad I found this… I was thinking I would have to write my own networking protocols, which would just slow down development for me… +1 to you, Lyqyd.