Posted 23 March 2012 - 07:35 PM
Hey I have the following code. When I client connects it checks it isn't already connected and then adds it and sends the "ready" signal back. The issue is that while the code seems to be working fine nothing is sent to the client! The clients code is fine (I used the "LUA" command to open the lua console on another machine and manually sen tback my reply to the client, it recieved it fine).
clients = {}
client_user = {}
user = {}
function addClient(id)
write("Adding Client #")
write(id)
write("\n")
size = table.getn(clients)
i = 1
while i <= size do
if clients[i] == id then
write("Refused Client ")
write(id)
write(", already joined \n")
return false
end
i = i + 1
end
ssiReply = "ready"
print("Sending response")
rednet.send(id, ssiReply)
n = size + 1
clients[n] = id
write("Client ")
write(id)
write(" successfully joined! \n")
end
function addUser(user, pass)
end
function authUser(user, pass)
end
function init(side)
write("Micro-Roast Domain server 1.0 Starting! \n")
write("MRD is starting on the ")
write(side)
write(" side! \n")
rednet.open(side)
user[0] = {"root","pwd"}
end
init("back")
run = true
while run == true do
local sender, message = rednet.receive()
write("Computer #")
write(sender)
write(" said ")
write(message)
write("\n")
if message == "join" then
addClient(sender)
end
if message == "shutdown" then
print("Shutting down")
run = false
end
end