Jump to content




[1.5+] In-depth Modem Channels Tutorial

wireless networking peripheral

69 replies to this topic

#61 theoriginalbit

    Semi-Professional ComputerCrafter

  • Moderators
  • 7,332 posts
  • LocationAustralia

Posted 30 July 2013 - 04:33 AM

 makerimages, on 30 July 2013 - 03:47 AM, said:

Does the 128 channel limitation apply for a specific modem, a specific computer or the entire world?
Per modem. So if you have a computer with all 6 sides as modems you can have 768 channels open at any given point in time.

#62 makerimages

  • Members
  • 236 posts

Posted 30 July 2013 - 04:43 AM

ok, thanks
Edit: a few pages back, there was a piece of code to listen on all open channels, i implemented that into this program:
term.clear()
local modem=peripheral.wrap("left")
local SiteLookup={}
local function listen()
  while true do
	    local evts = {os.pullEvent()}
	    if evts[1] == "timer" then
		   return
	    elseif evts[1] == "modem_message" then
		   print("Message: "..evts[4])
	    end
  end
end
local max = 65535
local large = 128
while true do
for i=1, max, large do
  for x=i, i+large do
	    modem.open(x)
  end
	    os.startTimer(2) --Listen for two seconds and then move on to the next range
	    listen()
  for x=1, i+large do
	    modem.close(x)
  end
end
end

it says that on line 21 ( the line with modem.open(x) ) there are too many open channels. how do I fix this?

#63 Bubba

    Use Code Tags!

  • Moderators
  • 1,142 posts
  • LocationRHIT

Posted 30 July 2013 - 08:29 AM

 makerimages, on 30 July 2013 - 04:43 AM, said:

-snip-

Look at your closing for loop:
  
for x=1, i+large do
   modem.close(x)
end

x=1 should be x=i

#64 jesusthekiller

  • Banned
  • 562 posts
  • LocationWrocław, Poland

Posted 30 July 2013 - 09:38 AM

Just stumbled across this post, really nice tutorial :)

#65 makerimages

  • Members
  • 236 posts

Posted 31 July 2013 - 03:45 AM

 Bubba, on 30 July 2013 - 08:29 AM, said:

 makerimages, on 30 July 2013 - 04:43 AM, said:

-snip-

Look at your closing for loop:
  
for x=1, i+large do
   modem.close(x)
end

x=1 should be x=i

that fixed nothing

term.clear()
local modem=peripheral.wrap("left")
local SiteLookup={}
local function listen()
  while true do
	    local evts = {os.pullEvent()}
	    if evts[1] == "timer" then
		   return
	    elseif evts[1] == "modem_message" then
		   print("Message: "..evts[4])
	    end
  end
end
local max = 65535
local large = 128
while true do
for i=1, max, large do
  for x=i, i+large do
	    modem.open(x)
  end
	    os.startTimer(2) --Listen for two seconds and then move on to the next range
	    listen()
  for x=i, i+large do
	    modem.close(x)
  end
end
end

same error (too many open channels) same line(modem.open(x))

#66 Bubba

    Use Code Tags!

  • Moderators
  • 1,142 posts
  • LocationRHIT

Posted 31 July 2013 - 08:03 AM

 makerimages, on 31 July 2013 - 03:45 AM, said:

same error (too many open channels) same line(modem.open(x))

Oops sorry. You should leave the correction there as it is a performance improvement, but it's not the issue. The issue is that you're adding i+large, which would actually be 129 channels instead of 128. Change it instead to i+large-1

#67 tuocuggino

  • New Members
  • 1 posts

Posted 13 August 2013 - 02:12 PM

hi guys,
i'm not able to understand where where is the error on this programs:

turtle with a gate reader:
modem = peripheral.wrap("right")
m = peripheral.wrap("left")
while true do
	    data = m.get()
	    modem.transmit(1,2,data)
	    count = 0
	    for i in pairs(data) do
			    if i ~= nil then
					    count = count + 1
			    end
	    end
	    print(count)
end

Computer:
modem = peripheral.wrap("top")
modem.open(1)
local event, modemSide, senderChannel, replyChannel,
message, senderDistance = os.pullEvent("modem_message")
for i,v in pairs(message) do
    print(i..":"..tostring(v))
end

the computer give me a error, it say something like " the variabile message must be a table"

#68 PsychicMiner2025

  • New Members
  • 1 posts

Posted 21 April 2016 - 05:27 AM

 MudkipTheEpic, on 10 February 2013 - 04:54 AM, said:

Wow... Code for snooping on all channels...

modem = peripheral.wrap(modemside)
for i=0, 65535 do -- Or how ever many channels there are
modem.open(i)
end

Would this allow you to snoop on rednet.send messages?

Edit: Wait.. can you only listen on 1 channel?

You could have a huge array of computers with wireless modems, all connected by network cables to a drive. Then you could set each computer (even thought it would take a while) to listen on different channels, each listening to 128 channels. e.g. computer 1, 1-128, computer 2, 129-256 ect. Then when a modem receives a message it would write the send and reply channels, the modem side and dist and message and write it to a file on the networked disk drive. not very practical in survival mode since you would need about 12131 stone 1112 redstone 512 ender pearls or 32 stacks! 512 glass panes and around 135 hours of smelting the stone (in one furnace) so dont attempt in survival mode. im sure there's easier ways to do this and since wireless modems only have a max range of 381 blocks at max altitude this would only get a very small scan range but would be good in a populated area in a server. you always could have less or even one modem that is quickly switching between groups of channels but then theres the chance you could miss a message. you could build a box made of computers reducing the wire needs and decreasing the chance that a signal or a low channel that is only in range of the high channel end of a line gets missed. anyway because of the 256 max range of wires you would have to put computers on both sides of a half length wire if you made a long line. sorry for the long post. also this is my first post. far from a "hi i'm new"











and one floppy disk ;)

#69 valithor

  • Members
  • 1,053 posts

Posted 23 April 2016 - 01:12 AM

 PsychicMiner2025, on 21 April 2016 - 05:27 AM, said:

-snip

This is actually something that I have seen a few times on servers. The one improvement you can make to the system you described is having 5 wireless modems per computer instead of 1 (can open 128 channels per modem not computer), and 1 wired modem to connect to the drive. This would cut down on the costs.

edit:

Also welcome to the forums :D

Edited by valithor, 23 April 2016 - 01:12 AM.


#70 MineRobber___T

  • Members
  • 50 posts
  • LocationStop being nosy

Posted 13 November 2016 - 03:03 AM

I did some math. Guess how many modems you need in order to scan all channels at once?

The answer: 534.

My explanation:

Spoiler






1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users