Posted 04 January 2013 - 01:20 PM
                EDIT: SOrry about the title, forgot to actually put one in there, it's late, fixed now…
Hello everyone,
First post here on the cc forums. I'm currently working on a small server/client protocol using rednet for keeping track of my turtles. Now i've run into a bit of a snag concerning message "collision". This is mainly a problem when launching the game, but might randomly occur at any point in time.
Here is a simplified version of the client announce function. The problem i'm having is, that some turtles never get recognized by the server on statup since the rednet events seem to get lost on the server. Now, is it possible to somehow "queue" events, so that the important one (the acknowledgement from the server) doesn't get drowned in the different broadcasts the clients are sending?
Thanks a bunch in advance,
-Lukas
                
            Hello everyone,
First post here on the cc forums. I'm currently working on a small server/client protocol using rednet for keeping track of my turtles. Now i've run into a bit of a snag concerning message "collision". This is mainly a problem when launching the game, but might randomly occur at any point in time.
Here is a simplified version of the client announce function. The problem i'm having is, that some turtles never get recognized by the server on statup since the rednet events seem to get lost on the server. Now, is it possible to somehow "queue" events, so that the important one (the acknowledgement from the server) doesn't get drowned in the different broadcasts the clients are sending?
local breakCond = false
while not breakCond do
  event, p1, p2 = os.pullEvent()
  if event == "rednet_message" then
	sender  = p1
	package = textutils.unserialize(p2)
	if package.dest ~= nil then
	  if (package.type == tnt.ACKNOWLEDGE) and (package.dest == os.getComputerID()) then
		print("Acknowledged by Server ID"..sender)
		breakCond = true
	  end
	end
  elseif event == "timer" then
	print("Request timed out")
	breakCond = true
  end
end
Thanks a bunch in advance,
-Lukas
 
        