Posted 31 January 2015 - 09:59 PM
Hi guys,
I'm having a little trouble with this piece of code:
What it does is that it takes the table it receives from a slaveRouter with all the client IPs of the slave routers. ClientIPs reffers to the already stored ids. The table is empty in the begining. DebugPrint prints the argument if debugOpt == true. Only for debugging. So the code is not working properly. If you want the whole code just check out this website. The three programs you need start with IPnet. I hope you can help me.
Thanks in advance. :)/>
I'm having a little trouble with this piece of code:
function getCientIPs()
while true do
local event, side, ch1, ch2, msg, distance = os.pullEvent("modem_message")
if ch1 == 65526 and ch2 == 1 then
local clientsToAnalyse = {}
local possibleClients = {}
possibleClients = textutils.unserialize(msg)
debugPrint("Possible clients: ")
debugPrint(textutils.serialize(possibleClients))
for i,v in pairs(clientIPs) do
for k,m in pairs(possibleClients) do
if v == m then
debugPrint("analyzing...")
clientsToAnalyse[k] = true
end
end
end
debugPrint("Clients to analyze: ")
debugPrint(textutils.serialize(clientsToAnalyse))
for i,v in pairs(clientsToAnalyse) do
if v ~= true or v == nil then
debugPrint("v: ")
debugPrint(v)
clientIPs[#clientIPs + 1] = possibleClients[i]
debugPrint("ClientIPs: ")
debugPrint(textutils.serialize(clientIPs))
end
end
end
end
end
What it does is that it takes the table it receives from a slaveRouter with all the client IPs of the slave routers. ClientIPs reffers to the already stored ids. The table is empty in the begining. DebugPrint prints the argument if debugOpt == true. Only for debugging. So the code is not working properly. If you want the whole code just check out this website. The three programs you need start with IPnet. I hope you can help me.
Thanks in advance. :)/>