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

Cant receive messages

Question

Here is receiver program:

event = require("event")
require("component").modem.open(1)
function receive ()
  while true do
    local eventData = { event.pull() }
    if eventData[1] == "modem_message" then
      local message = eventData[6]
      local port = eventData[4]
      local adress = eventData[3]
      return message, port, adress
end end end
while true do
  local m, p, a = receive()
  print(p)
end

And here is sender program:

m = require("component").modem
print("Type address")
adr = io.read()
print("Type message")
msg = io.read()
if m.send(adr, 1, msg) == true then
  print("Message sended succesfully")
else
  print("Error occured")
  computer.beep(500)
  os.sleep(0.5)
  computer.beep(500)
end

And the problem: receiver receives only broadcast messages.

I use wireless card on tablet and on PC

Link to post
Share on other sites

6 answers to this question

Recommended Posts

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.