if i get a KEYREQ message i get a error that says: rednet:87 Expected number.
can someone help?
term.setTextColor(colors.blue)
term.clear()
term.setCursorPos(1,1)
print("Server started!")
print("------------------------")
rednet.open("back")
while true do
id,msg = rednet.receive()
print("Listening")if msg == "SENDING" then
stringid = tostring(id)
print("Got MSG from:",stringid)
if fs.exists(stringid) == false then
print("File does not exist")
else
local file1 = fs.open(stringid,"w")
contents = file1.readAll()
file1.close()
print("Requesting password")
rednet.send(id,"REQKEY")
id1, msg1 = rednet.receive(10)
end
end
if contents == msg1 then
rednet.send(id1,"scs")
print(stringid,"Logged in successfully")
end
if msg == "KEYREQ" then
print("File already exists!")
else
print("Got MSG2 from:",stringid)
random = math.random(1000000,10000000)
stringrandom = tostring(random)
print("Generated random")
rednet.send(id,stringrandom)
print("Sent Password")
id2, msg2 = rednet.receive()
local file = fs.open(stringid,"w")
file.write(msg2)
file.close()
end
end
1
3 replies to this topic
#1
Posted 29 May 2016 - 02:44 PM
#2
Posted 29 May 2016 - 05:12 PM
In my case, it's because contents = nil and msg1 = nil so it tried to use id1 which is nil.
File from which contents comes from is not created on my end
File from which contents comes from is not created on my end
Edited by TYKUHN2, 29 May 2016 - 05:13 PM.
#3
Posted 29 May 2016 - 07:26 PM
What is the last thing that gets printed?
#4
Posted 01 June 2016 - 07:47 AM
i already fixed it but thank for the help
1 user(s) are reading this topic
0 members, 1 guests, 0 anonymous users