Volaik

swarmServant

Nov 12th, 2021 (edited)
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.47 KB | None | 0 0
  1. io.write("Enter server port: ")
  2. SERVER_PORT = tonumber(io.read())
  3. io.write("Enter client port: ")
  4. CLIENT_PORT = tonumber(io.read())
  5.  
  6. local modem = peripheral.find("modem")
  7. modem.open(CLIENT_PORT)
  8.  
  9. modem.transmit(SERVER_PORT, CLIENT_PORT, "connectMessage")
  10.  
  11. while true do
  12.     event, modemSide, senderChannel, replyChannel, message, distance = os.pullEvent("modem_message")
  13.     if message == "connectSuccess" then
  14.         print("Connected to "..senderChannel)
  15.     end
  16. end
Add Comment
Please, Sign In to add comment