Jump to content




Rednet localhost


2 replies to this topic

#1 MrObsidy

  • Members
  • 63 posts
  • LocationHesse, Germany

Posted 04 May 2019 - 03:48 PM

Hello! Currently I am writing a display manager software (Think X11) that should consists of a server (who runs the actual programs) and some clients (which runs the I/O, you can have multiple clients per server, so you could have headless systems (=non-advanced computers that run "advanced" software)).
Now since most users (including me) tend to run programs locally, I want to have the possibility to run a tserver and tclient on the same machine and connect the tclient to the local tserver.
Issue is, that I want to send the I/O information and the frame information via rednet (so I can have a display server and multiple clients.)

So this brings up two questions for me:

1) Can I rednet-connect to localhost and if so
2) can I do so without having a modem installed (Needing a modem to connect to localhost is pointless, let's face it.)?

Hope somebody can answer this.

EDIT: By testing, I found out that rednet.send(os.getComputerID(), <message>) works just as it should AND that this works regardless if a modem is opened.
Meaning this works even if no modem is open or attached:
rednet.send(os.getComputerID(), "Testmsg")

local sender, msg = rednet.receive()

print(msg)
will output
 Testmsg 
just as expected.

Edited by MrObsidy, 04 May 2019 - 04:11 PM.


#2 Lupus590

  • Members
  • 2,029 posts
  • LocationUK

Posted 04 May 2019 - 08:54 PM

For no modem I think you will need to create a fake rednet/modem API.

With a modem (wired or wireless) you should be able to send a message to your own computer id (although I seem to think that rednet will filter this out so you may want to check that).

Personally I would just have the server act as a local client while also doing the server stuff.

#3 Luca_S

  • Members
  • 407 posts
  • LocationGermany

Posted 04 May 2019 - 09:49 PM

View PostLupus590, on 04 May 2019 - 08:54 PM, said:

For no modem I think you will need to create a fake rednet/modem API.

With a modem (wired or wireless) you should be able to send a message to your own computer id (although I seem to think that rednet will filter this out so you may want to check that).

Personally I would just have the server act as a local client while also doing the server stuff.

If only rednet is used then sending messages to the current computer doesn't require a modem. It is first checked if the message goes to the computer it originates from and only if it isn't it will check if there are open modems: https://github.com/S.../rednet.lua#L85

Edited by Luca_S, 05 May 2019 - 05:50 AM.






1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users