172 posts
Location
USA
Posted 28 September 2016 - 12:26 AM
Hi Guys!
I am currently programming a router program for ComputerCraft and i have a wired modem and a wireless modem. How do i only receive messages with the wireless modem and send the received message across the wired modem network.
Thanks!
7083 posts
Location
Tasmania (AU)
Posted 28 September 2016 - 12:34 AM
When you call rednet.send() or rednet.receive(), all open modems are used. So it's simply a case of rednet.open()ing the wired modem and rednet.close()ing the wireless before sending, and vice versa before receiving.
172 posts
Location
USA
Posted 28 September 2016 - 12:48 AM
Well if i close off the wired modem and only keep the wireless modem on then how will i be able to upload data because only the download portion will be active if i do that
Is there a way i can make a custom rednet API or something to only use the selected modem side or something
Edited on 27 September 2016 - 10:49 PM
7083 posts
Location
Tasmania (AU)
Posted 28 September 2016 - 12:52 AM
As mentioned, invert the modem states.
rednet.open("yourWirelessModem")
rednet.close("yourWiredModem")
local sender, message, protocal = rednet.receive()
rednet.open("yourWiredModem")
rednet.close("yourWirelessModem")
rednet.send(target, message)
463 posts
Location
Star Wars
Posted 28 September 2016 - 03:52 PM
You can also use the native
modem API, but rednet already handles the IDs.