Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- CLIENT_PORT = 0
- io.write("Set a server port: ")
- SERVER_PORT = io.read()
- print()
- local modem = peripheral.find("modem")
- modem.open(SERVER_PORT)
- if CLIENT_PORT == 0 then
- print("I am not broadcasting to anyone")
- end
- while true do
- event, modemSide, senderChannel, replyChannel, message, distance = os.pullEvent("modem_message")
- if message == "connectMessage" then
- print("Connection detected from "..senderChannel)
- modem.transmit(senderChannel, SERVER_PORT, "connectSuccess")
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement