Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- Wireless MODEM
- if fs.exists(".settings") == false then
- v = 1
- else
- shell.run(".settings")
- v = 0
- rednet.open(side)
- modem = peripheral.wrap(lanSide)
- end
- shell.run("id")
- while true do
- if v == 0 then
- ids, msg, ptrc = rednet.receive()
- print("Ricevuto "..msg)
- print("Inoltro richiesta a "..msg..":80")
- modem.sendChannel(80, msg)
- modem.setListening(80, true)
- local event, side, id, chn, mess = os.pullEvent("lan_message")
- print("Ricevuto risposta da: 144.91.97."..id)
- sleep(2)
- rednet.send(ids, mess)
- elseif v == 1 then
- print("Inserisci il lato del wm:")
- local side = read()
- print("Ora inserisci il lato del modem LAN:")
- local lanSide = read()
- file = fs.open(".settings", "w")
- file.writeLine("side = '"..side.."'")
- file.writeLine("lanSide = '"..lanSide.."'")
- file.close()
- end
- sleep(0.5)
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement