mirror of
https://github.com/Kiritow/OpenComputerScripts.git
synced 2024-03-22 13:10:46 +08:00
fix bugs in fileshare
This commit is contained in:
parent
7df4924b16
commit
8f22b594d4
|
@ -40,9 +40,14 @@ if(not modem.open(22)) then
|
|||
return
|
||||
end
|
||||
|
||||
if(opts["b"]) then
|
||||
print("Broadcasting at port " .. port)
|
||||
modem.broadcast(port,"fs_req",filename)
|
||||
else
|
||||
print("Connecting to " .. server .. " at port " .. port)
|
||||
print("Press Ctrl+C will stop this process")
|
||||
modem.send(server,port,"fs_req",filename)
|
||||
end
|
||||
print("Press Ctrl+C will stop this process")
|
||||
while true do
|
||||
local e=WaitMultipleEvent("modem_message","interrupted")
|
||||
if(e.event=="modem_message" and e.port==22) then
|
||||
|
@ -58,7 +63,7 @@ while true do
|
|||
if(not ret) then
|
||||
print("[Error] Failed while writing file: " .. err)
|
||||
else
|
||||
print("[Done] Data written to file: " .. err)
|
||||
print("[Done] Data written to file: " .. localfile)
|
||||
end
|
||||
f:close()
|
||||
end
|
||||
|
|
|
@ -100,6 +100,6 @@ if(opts["d"]) then
|
|||
PushEvent(thisid)
|
||||
print("[Done] FileShare Server started.")
|
||||
else -- Run in foreground
|
||||
fss_server_main()
|
||||
fss_server_main(print,table.pack("modem_message","fss_stop","interrupted"))
|
||||
print("[Stopped] File Share Server stopped.")
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue
Block a user