Jump to content




rednet error


  • You cannot reply to this topic
7 replies to this topic

#1 TR1T0N_

  • Members
  • 46 posts

Posted 14 December 2013 - 07:45 PM

hello. im getting the error "rednet: 43: No open sides"
The code is for a firewall that i am using for my bank system.
realid = 5
function spoof(nID)
print("start spoof")
  local func = loadstring("return "..nID)
	os.getComputerID = func
  os.computerID = func
end
function unspoof()
print("end spoof")
  spoof(5)
end
--firewall start
rednet.open("top")
print("1")
while true do
var1, var2, var3 = rednet.receive()
print("id = "..var1)
print("msg = "..var2)
print("distance = "..var3)
print("2")
if var1 == 9  then
print("3")
rednet.open("back")
print("4")
spoof(var1)
print("5")
rednet.send(4, var2)
print("6")
else
rednet.send(var1, "deny")
print("7")
end
end
but for some reason it will not work and keeps giving me the same error and sorry for my horrible formatting. Any help would be much appreciated.

#2 TheOddByte

    Lazy Coder

  • Members
  • 1,607 posts
  • LocationSweden

Posted 14 December 2013 - 07:47 PM

You haven't opened a modem
rednet.open("<side>") -- back, front, left, right, top, bottom

Also, Why are you using loadstring? Here's an easier method
local getID = os.getComputerID -- Backing up the old function
os.getComputerID = function(nID) -- Overriding it
    return nID or getID() -- Returning the fake id or the regular computer ID
end

Edited by Hellkid98, 14 December 2013 - 07:53 PM.


#3 TR1T0N_

  • Members
  • 46 posts

Posted 14 December 2013 - 07:50 PM

Both modems have been opened on lines 15 and 25.

#4 TheOddByte

    Lazy Coder

  • Members
  • 1,607 posts
  • LocationSweden

Posted 14 December 2013 - 08:03 PM

Oh, Lol.. Missed that xD
Try to just use one modem

Edited by Hellkid98, 14 December 2013 - 08:03 PM.


#5 Bomb Bloke

    Hobbyist Coder

  • Moderators
  • 7,099 posts
  • LocationTasmania (AU)

Posted 14 December 2013 - 09:43 PM

If I'm not mistaken, shouldn't "os.computerID" be a number, not a function?

The rednet API isn't built for this sort of thing. Instead of jumping through all these hoops, you may be better off using the modem API directly - this simply hands you control over which channels to listen/send through, rather then trying to limit you to whatever your computer ID happens to be. And since the rednet API gets the modem API to do much of its work anyway, transmissions are compatible between the two.

Eg:

Spoiler

Edited by Bomb Bloke, 14 December 2013 - 09:43 PM.


#6 Lyqyd

    Lua Liquidator

  • Moderators
  • 8,465 posts

Posted 15 December 2013 - 03:13 AM

It's a function that returns a number, just like os.getComputerID.

#7 theoriginalbit

    Semi-Professional ComputerCrafter

  • Moderators
  • 7,332 posts
  • LocationAustralia

Posted 15 December 2013 - 03:15 AM

Yeh stupid naming convention really. os.getComputerID === os.computerID and os.getComputerLabel === os.computerLabel

#8 TR1T0N_

  • Members
  • 46 posts

Posted 15 December 2013 - 11:22 AM

Thanks for the help everyone it was the id spoofing causing the error. and i think it will need a bit of a rewrite using os.pullevent() as it is not very efficient at the moment.





3 user(s) are reading this topic

0 members, 3 guests, 0 anonymous users