Advertisement
SkyFlash21

Untitled

Jul 13th, 2021
51
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.65 KB | None | 0 0
  1. --VARIABLES
  2. local event = require("event")
  3. local net = require("internet")
  4. local term = require("term")
  5. local os = require("os")
  6.  
  7. local running = true
  8.  
  9. local con = net.open("192.168.1.100", 6667)
  10.  
  11. --FUNCTIONS
  12. function sendString(s)
  13. con:write(s)
  14. print('Sending ' .. string.sub(s,1,s:len()-1) .. ' to server...')
  15. con:flush()
  16. end
  17.  
  18. function reciveString()
  19. local s = con:read()
  20. print('Recived ' .. s .. ' from server...')
  21. con:flush()
  22. end
  23.  
  24. --MAIN
  25.  
  26. if con then
  27. print('Connected to the server!')
  28. end
  29.  
  30. while running do
  31. local s = term.read()
  32. sendString(s)
  33. reciveString()
  34. os.sleep(0)
  35. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement