This is a read-only snapshot of the ComputerCraft forums, taken in April 2020.
mister-man's profile picture

Rednet repeater question.

Started by mister-man, 18 September 2013 - 05:30 PM
mister-man #1
Posted 18 September 2013 - 07:30 PM
Hay,

I tried to open a new topic with my question, but the forum said: "You cannot start a new topic"!

My Question:
I wrote a script that repead a wired modem signal, because after 250 - 300 blogs modemcable there is no rednet signal (broadcast). But these code seems to crash the server after a few hours. If I remove the "repeater" the server works fine.

My Code:


--#####################
--#  Network-Repeater	 #
--#####################
--##########
--# Config #
--##########
-- Modem side (left, right, front, back, top, bottom)
local modemSide1 = 'left'
-- Modem side (left, right, front, back, top, bottom)
local modemSide2 = 'right'
------------------------------------
local compID = 0
function load()
  compID = getID()
  rednet.open(modemSide1)
  rednet.open(modemSide2)
  router()
end
function getID()
  return os.getComputerID()
end
function _route(msg)
  rednet.broadcast(msg)
end
function router()
  print('route')
  while true do
    local sEvent, sSide, sChannel, sReplyChannel, sMessage, nDistance = os.pullEventRaw("modem_message")
    rednet.close(sSide)
    _route(sMessage)
    rednet.open(sSide)
  end
end
load()

Thanks for helping ;)/>
Lyqyd #2
Posted 18 September 2013 - 11:38 PM
Split into new topic.

Go read the sticky posts.
mister-man #3
Posted 19 September 2013 - 09:29 AM
Okay, I read the sticky post.
But I can't find a solution for my error.

PS: Sorry for false way to posting!