What this thing does:
Spoiler
It basically builds up a connection between two computers in a more secure way than RedNet.How it works:
- The host specifies a channel for the connection, the 2nd computer connects to it
- Ones the host recognizes a 2nd connection, it generates a random number (between 1 and 65535) and passes it to the 2nd computer.
- He then generates a random string, containing symbols and numbers, and passes that to the 2nd computer too.
- The host then closes the channel and opens a new one using the new generated number.
- The 2nd computer connects to that using the number the host gave him.
- The API passes a random number and opens a new channel on that to prevent from a 3rd party being able to listen on the connection between the 2 computers.
- Sure he can guess the channel but it'd need a while.
- It also passes a random string to the 2nd computer, because it ENCRYPTS the messages using that string.
- Which leads to a higher security if a 3rd party is listening on that channel too.
Ones the host or the client leaves the connection, they'll have to make a new one.
How to build up a basic connection (example):
Spoiler
HOST COMPUTER CODE:
os.loadAPI("/modEM")
modEM.host(1, "top")
while true do
print(modEM.receive())
end
CLIENT COMPUTER CODE:
os.loadAPI("/modEM")
print("opening")
modEM.open("top")
print("Connecting")
local ok, err = modEM.connect(1)
if ok == false then
printError(tostring(err))
return
end
local e = "hello"
while true do
e = read()
local ok = modEM.send(e)
if ok == false then
printError(tostring(err))
return
end
end
WHAT TO DO:
- Set up a modem on the top (on both computers)
- Start up the host file first
- Start up the client file
- Start writing messages on the client computer and watch them getting printed on the host
- Disconnect the client or host (for example by rebooting) and realize that you have no way of reconnecting
Download:
Pastebin
pastebin get D5RDJYE6 modEM
Credits:
Password based encryption - By PixelToast
If you have any questions, feel free to ask me :)/>