I'm on the Enigmatica 2 Expert Modpack and trying to get a simple wireless network up and running. I wrote two programs in MineOS to send and receive broadcast messages. Unfortunately, the receiver seems to randomly drop some.
This is the recevier:
local event = require("event")
local comp = require("component")
---------------------------------------------------------------------------------
modem = comp.get("modem")
modem.open(1)
-- modem_message signature: type: string = "modem_message", localAddress: string, remoteAddress: string, port: number, distance: number, ....
local function ModemEventHandler(e1,localAddress,remoteAddress,port,distance,data1,data2,data3)
if type(e1) == "string" then
print(e1)
if e1 == "modem_message" then
print("Distance: " .. distance .. " contents: " .. data1)
end
end
end
---------------------------------------------------------------------------------
event.addHandler(ModemEventHandler)
This the sender:
-- Import libraries
local event = require("event")
local cp = require("component")
---------------------------------------------------------------------------------
modem = cp.get("modem")
function Timer1_s()
data = "sent some data " .. computer.uptime()
res = modem.broadcast(1,data)
if res then
st = "true"
else
st="false"
end
print(data .. " " .. st)
end
event.addHandler(Timer1_s,1)
The sender always prints the uptime and true whereas the receiver seems to skip around 10% of them. Range is 65.97, everything is max tier. Any idea on what could be causing this or do you suspect it has to do with MineOS not handling the events properly?
Edit:
I went ahead and made another computer and put it 2 blocks away from the sender. This machine reliably receives the messages. What could be going on? Everything is chunkloaded and the wiki says explicitly that packets cannot get lost.
You can post now and register later.
If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.
hi all,
I'm on the Enigmatica 2 Expert Modpack and trying to get a simple wireless network up and running. I wrote two programs in MineOS to send and receive broadcast messages. Unfortunately, the receiver seems to randomly drop some.
This is the recevier:
local event = require("event") local comp = require("component") --------------------------------------------------------------------------------- modem = comp.get("modem") modem.open(1) -- modem_message signature: type: string = "modem_message", localAddress: string, remoteAddress: string, port: number, distance: number, .... local function ModemEventHandler(e1,localAddress,remoteAddress,port,distance,data1,data2,data3) if type(e1) == "string" then print(e1) if e1 == "modem_message" then print("Distance: " .. distance .. " contents: " .. data1) end end end --------------------------------------------------------------------------------- event.addHandler(ModemEventHandler)
This the sender:
-- Import libraries local event = require("event") local cp = require("component") --------------------------------------------------------------------------------- modem = cp.get("modem") function Timer1_s() data = "sent some data " .. computer.uptime() res = modem.broadcast(1,data) if res then st = "true" else st="false" end print(data .. " " .. st) end event.addHandler(Timer1_s,1)
The sender always prints the uptime and true whereas the receiver seems to skip around 10% of them. Range is 65.97, everything is max tier. Any idea on what could be causing this or do you suspect it has to do with MineOS not handling the events properly?
Edit:
I went ahead and made another computer and put it 2 blocks away from the sender. This machine reliably receives the messages. What could be going on? Everything is chunkloaded and the wiki says explicitly that packets cannot get lost.
Link to post
Share on other sites