Advertisement
DOGGYWOOF

client

Jan 6th, 2024 (edited)
7
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.76 KB | None | 0 0
  1. -- Open Rednet on the same side as the server
  2. rednet.open("top")
  3.  
  4. -- Prompt user to enter the server ID
  5. print("Enter Server ID:")
  6. local serverId = tonumber(read())
  7.  
  8. -- Prompt user to enter the file to send
  9. print("Enter File Name to Send:")
  10. local fileName = read()
  11.  
  12. -- Read the file content to send
  13. local fileContent = ""
  14. local file = fs.open(fileName, "r")
  15. if file then
  16. fileContent = file.readAll()
  17. file.close()
  18.  
  19. -- Send the file content to the server using the specified ID
  20. local success = rednet.send(serverId, fileContent, "file_transfer")
  21. if success then
  22. print("File sent to the server")
  23. else
  24. print("Failed to send the file. Check server ID or Rednet connection.")
  25. end
  26. else
  27. print("File not found or could not be read.")
  28. end
  29.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement