Jump to content
  • Sky
  • Blueberry
  • Slate
  • Blackcurrant
  • Watermelon
  • Strawberry
  • Orange
  • Banana
  • Apple
  • Emerald
  • Chocolate
  • Charcoal
  • 0
PyroRider

Network messages repeat multiple times?

Question

First my code on the receiving side:

local component = require("component")
local event = require("event")
local m = component.modem
m.open(1)
print(m.isOpen(1))
while true do
  local _, _, from, port, _, message = event.pull("modem_message")
  os.sleep(1)
  if message ~= "" then
    print("message")
  end
end

My problem is, I'm sending one broadcast ("Test") and a second later I'm sending a direct message ("Test2").

The receiving server then prints out the broadcast nearly 8 times before the direct message gets repeated 6 times. From Google I know that this shouldn't be, but I can't figure out what I've done wrong.

Heeeeeeeellllppppp XD

Share this post


Link to post
Share on other sites

2 answers to this question

Recommended Posts

  • 0

First, why are you sleeping after event.pull() , that's unneccesary and could cause issues where a event is missed.

Second, how are the computers connected (picture), Are the computers separated by a swich, is there a loop where the swich receives a packet twice (This is the most likely reason for duplicating messages.)

Share this post


Link to post
Share on other sites
  • 0
On 12/9/2019 at 3:58 PM, SpaceBeeGaming said:

First, why are you sleeping after event.pull() , that's unneccesary and could cause issues where a event is missed.

Second, how are the computers connected (picture), Are the computers separated by a swich, is there a loop where the swich receives a packet twice (This is the most likely reason for duplicating messages.)

the sleep was a try to prevent multiple network reading, didnt worked. The computers were connected only by cables, now everything is fine and working, i also built everything new. I believe i had the switch function in one of the racks activated so that may have caused the repetitions

Share this post


Link to post
Share on other sites

Join the conversation

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.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use and Privacy Policy.