Posted 27 February 2012 - 05:08 AM
So im messing around with rednet, and im trying to build a client server sort of system where I have a mainframe that has passcodes with clearance levels assigned to each one (one pass has a level three clearance another would have a level 1) (i know that this isnt very creative but im still trying to learn the api…) anyways, the client runs a program that will transmit a password to the server, the server then checks the password and sends the clearance number to the client, if the level isnt high enough there is no entry if it is then you can go in…
so as a test i mad a small program on the server that receives the code and if the code is right, it will send "true" to the client,
heres the code…
pass = rednet.receive(timeout)
if pass == 12345 then
rednet.broadcast(1)
end
Im pretty sure that the clients code is the problem though, the server is set to run the program once then it goes back to normal same with the client, but the client doesnt go back to normal… It stays as if its still waiting to receive…. the code for that is,
write "Enter Clearance Code…"
input = read()
rednet.broadcast(input)
code= rednet.receive(timeout)
if code == "true" then
print("TRUE")
end
if someone could tell me what im doing wrong and possible tell me what would work better i would appreciate it…
thanks in advance
so as a test i mad a small program on the server that receives the code and if the code is right, it will send "true" to the client,
heres the code…
pass = rednet.receive(timeout)
if pass == 12345 then
rednet.broadcast(1)
end
Im pretty sure that the clients code is the problem though, the server is set to run the program once then it goes back to normal same with the client, but the client doesnt go back to normal… It stays as if its still waiting to receive…. the code for that is,
write "Enter Clearance Code…"
input = read()
rednet.broadcast(input)
code= rednet.receive(timeout)
if code == "true" then
print("TRUE")
end
if someone could tell me what im doing wrong and possible tell me what would work better i would appreciate it…
thanks in advance