5 posts
Posted 31 July 2013 - 06:25 AM
Ive been trying to work with relays for some turtle work did a lot of reading but none really help me out
Im trying to write a code that does NOT just broadcast it's received message I want to be able to define the computer its sent too. with bigger networks broadcasts can be messy if you have a few turtles working of the same programs just to speed up the process.
Hope that makes sense
8543 posts
Posted 31 July 2013 - 12:37 PM
Split into new topic.
Please post the code you have so far in implementing the idea and state the issues with it, or ask a more specific question about the problem you're having with the concept.
5 posts
Posted 31 July 2013 - 02:54 PM
the code Im working with is fragmented I could try and post but it may not make much sense. this is my first coding experiance so bear with me lol
8543 posts
Posted 31 July 2013 - 03:00 PM
From a design standpoint, the issue with trying to restrict what messages are sent from what relays is that you have to identify what relays can reach which devices. You then have to include logic that helps a relay decide if it should ignore a message because it can't reach the intended destination, or relay the message to another relay that can. In the end, the bandwidth you save by filtering out relays that can't help efficiently deliver a message gets used up deciding whether or not a given relay can help efficiently deliver a message.
I'm working on a project now that makes use of computers that serve as both GPS hosts and relays. In order to address potential issues that could arise from relays bouncing messages back and forth between one another, every message sent on my network is assigned a unique message ID and is alse stamped with the label, ID, and channel of the origin device. Received messages are compared to a communication log stored on each receiving device. If the origin information and message ID are already in the log, the device knows that it has a duplicate message and ignores it.
To be honest, your solution sounds worse than the problem you're trying to fix. It's not too difficult to set up a system wherein a message is only sent to the computers necessary to relay it to the desired recipient. Using broadcasts and having every computer in range evaluate the packet seems far worse.
5 posts
Posted 31 July 2013 - 03:32 PM
Here is my code sorry it took so long
message is a simple rednet.send(6, "bridge")
–Bridge– on #6
term.setCursorPos(1,1)
term.clear()
term.write("Building the bridge")
rednet.send(0, "Building started")
rednet.send(3, "edgeL")
rednet.send(5, "edgeR")
sleep(2)
rednet.send(4, "mid")
–Relay startup– on #6
rednet.open("top")
shell.run("id")
print("Relay is now on")
print("While idle all messages will be passed on")
print("To run a program please enter the name and hit enter")
function1 = function()
rednet.receive()
–print(message)
shell.run(message)
end
function2 = function()
shell.run(read())
end
while true do
parallel.waitForAny(function1, function2)
end
–EdgeL & EdgeR (minor change)– on #3-5
x = place
y = back
for x = 1,20 do
turtle.select(1)
turtle.forward()
turtle.placeDown()
turtle.turnRight()
turtle.turnRight()
turtle.select(2)
turtle.place()
turtle.turnRight()
turtle.turnRight()
end
turtle.turnLeft()
turtle.forward()
turtle.turnRight()
for y = 1,10 do
turtle.back()
end
– Mid – on #3-5
x = place
y = back
for x = 1,20 do
turtle.select(1)
turtle.forward()
turtle.placeDown()
end
5 posts
Posted 31 July 2013 - 03:33 PM
Is it possible to bypass the shell.run("bridge") from the relay with out getting super complex?
oh and my turtle startup
rednet.close("right")
rednet.open("right")
shell.run("id")
while true do
senderId, message, distance = rednet.receive()
shell.run(message)
end
5 posts
Posted 31 July 2013 - 04:06 PM
Ok Ill have to do more work with functions these are my first scripts with them lol
what am I missing my relay wont send any messages to turtles my home computer gets the feed back but no turtle is responding to rednet atm