Also, if you could make sure that both computers are labelled, that would be great. And since the labels are used when attempting to connect to a computer by name, make sure that the label you are using matches the name of the computer that you're telling it to connect to.
#81
Posted 09 March 2013 - 07:17 AM
Also, if you could make sure that both computers are labelled, that would be great. And since the labels are used when attempting to connect to a computer by name, make sure that the label you are using matches the name of the computer that you're telling it to connect to.
#82
Posted 17 March 2013 - 04:57 PM
shiry, on 08 March 2013 - 12:20 PM, said:
Well, I was unsuccessful in duplicating the error. I ran your code exactly, on a correctly set up LyqydNet network, and it ran without issue.
If you're having trouble getting it to connect, make sure that all of the computers in the network are labelled. It may help to have a computer dedicated as a router. You've got the startup for each computer set up correctly as far as I can tell, so the labelling is the only issue I can think of. Let me know if you are still having issues and I can take a look at a world save if you're willing to upload one someplace.
#83
Posted 23 November 2013 - 11:43 PM
When I call sequential netfile.put() calls they fail, and it seems like I have to sleep() some to allow the next file to be sent.
Below is the function I am using. I think what may be happening is the last network transaction is not completed yet, therefore this one is failing, but I'm not sure. It is down in the net API where the it is failing at though.
local function pushUpdateToServer(serverLabel)
--test for updating self
if serverLabel == os.getComputerLabel() then
print("Cannot push to self. Skipping " .. serverLabel .. ".")
return
end
-- declarations
local serverConnection = false
local remoteDir = false
--read files config
local files = config.readConfig("/etc/files")
--open server connection
serverConnection, remoteDir = connection.open(serverLabel, port, timeout)
if not serverConnection then
print("Connection to " .. serverLabel .. " Failed!")
return
else
print("Connected to ".. serverLabel .." Path: ".. remoteDir)
end
-- loop over files list and update files
for k, v in pairs(files) do
local path = shell.resolve(str.replace(v[1], fs.getName(v[1]), ""))
local fullPath = shell.resolve(v[1])
--try to create remote directory
-- (this will happen a lot, may want to detect for it and create it conditionally)
if path ~= "/" and path ~= "" then
print("Sending mkdir " .. path)
connection.send(serverConnection, "fileMakeDirectory", path)
remoteDir = gatherResponse(serverConnection)
print("Response: " .. remoteDir)
end
-- put the file
write("Sending file: " .. fullPath .. " ")
local success = false
local retrys = 1
while not success do
write("..try" .. retrys)
success = netfile.put(serverConnection, fullPath, fullPath, timeout)
if retrys > 3 then
break
end
if not success then
retrys = retrys + 1
sleep(1)
end
end
if success then
print("..success.")
else
write("..failed. <CR>")
local junk = read()
return
end
end
--close server connection
if connection.close(serverConnection) then
serverConnection = false
print("Connection Closed.")
else
print("Could not close connection!")
end
end
You can see I've put in a retry system. It always seems to work on the second try.
Does anyone have any ideas on how I can improve this?
Edited by Timendainum, 23 November 2013 - 11:46 PM.
#84
Posted 23 November 2013 - 11:58 PM
#85
Posted 24 November 2013 - 12:46 AM
Lyqyd, on 23 November 2013 - 11:58 PM, said:
Yeah, that was my first thought as well. I have tried setting the timeout to as high as 60. I have set the sleep time to as low as 0.01 and it works every time.
full script is here:
https://github.com/T...update/push.lua
Edited by Timendainum, 03 December 2013 - 05:02 PM.
#87
Posted 24 November 2013 - 03:58 PM
I'm also working on a network peripheral Api and daemon. I may have some questions for you later this evening.
This Api is very cool. I've been having a lot of fun playing with it.
#88
Posted 26 November 2013 - 06:28 PM
API
http://pastebin.com/APNEz5BY
daemon
http://pastebin.com/XhaDnyZ8
I've noticed similar behavior with successive connections. I've had to put a sleep in before the connection to make sure successive connections will work.
#89
Posted 05 July 2014 - 04:32 AM
#90
Posted 08 July 2014 - 01:04 AM
shell.run("lyqydnet")
shell.run("routed")
i get these outputsFile not found File not found File not found File not found File not found SI SII'm not sure if a installed it correctly... any help would be appreciated!
I put them in a code tag because i don't know how to put an image into the post.
#91
Posted 08 July 2014 - 01:55 AM
Quote
#92
Posted 06 October 2014 - 04:12 AM
#93
Posted 03 November 2014 - 08:18 PM
Afaik it will require pairing (multiple) Modem names with computer ID.
Edited by tec_SG, 03 November 2014 - 08:22 PM.
#94
Posted 03 November 2014 - 09:57 PM
local modem = peripheral.wrap("right")--#Assuming your modem is on the right.
local function turnOnEveryone()
for _,i in pairs(modem.getNamesRemote()) do --#getNamesRemote grabs those peripheral names that you can't get, however through the wire.
if peripheral.getType(i) == "computer" then --#If the peripheral is a computer. This is in case you've got monitors and whatever connected
peripheral.call(i,"shutdown") --#Turn them off
sleep(0)
peripheral.call(i,"turnOn") --#Turn them on
end
end
end
#95
Posted 03 November 2014 - 10:04 PM
#96
Posted 04 November 2014 - 08:24 AM
Still idk if there is a method to get names of the "modems" (like "computer_##" since they are not per PC) connected to a PC(locally) without the need of other PC and data transfer, or just inputting the ## numbers manually.
EDIT:
preferably it can be done easily with
computer.getID() call per every modem-PC in the network and then just send turnOn() to matching pair
EDIT:2
Noticed only one hit for "transmit" so this is true
EDIT:3
So i did this: (from "net")
TurnOn_Packet=TurnOn_Packet or TurnOn_Broadcast or false
TurnOn_Broadcast=TurnOn_Broadcast or false
function raw_send (recipient, message, forceOn)
if forceOn or TurnOn_Packet then
if recipent==65535 and (forceOn or TurnOn_Broadcast) then
for _,v in ipairs(peripheral.getNames()) do--list peripherals
if string.find(v,"computer_") then --if computer
pcall(peripheral.call,v,"turnOn")--turn on
--pcall in case something gets changed when iterating
sleep(0.1)
end
end
else
for _,v in ipairs(peripheral.getNames()) do--list peripherals
if string.find(v,"computer_") then --if computer
t,PC=pcall(peripheral.call,v,"getID") --try to get ID
if t and PC==recipent then --if id OK
pcall(peripheral.call,v,"turnOn")--turn on
--pcall in case something gets changed when iterating
sleep(0.1)
end
end
end
pcall(peripheral.call,"computer_"..recipent,"turnOn")
sleep(0.1)
end
end
peripheral.call(modemSide, "transmit", recipient, os.computerID(), message)
end
And if I'am right this should allow the packet to turn on the desired pc if the correct flag is on, but still my point is to add configs allowing to:
1: turn on routers that are needed to forward a packet
2: turn on host that is the recipent
so it would :
-not turn on computers not needed in the process
-not turn on computers just for network discovery (finding/checking routes)
and another flag to allow turnOn broadcasts (so i can send data to everywhere without turning the computers on manually)
So i ask for the features above to be implemented, since finding every send, and raw_send instance in this api without it deep knowledge and appending this configs by me would probably end with just making it "bORkeD"
Edited by tec_SG, 04 November 2014 - 08:14 PM.
#97
Posted 05 November 2014 - 05:28 AM
#98
Posted 05 November 2014 - 06:11 AM
Edited by tec_SG, 05 November 2014 - 04:38 PM.
#99
Posted 05 November 2014 - 05:39 PM
I'll think about the feature request a bit more, though.
#100
Posted 05 November 2014 - 07:31 PM
.
But still it would be nice to have that functionality, for backwards compatibility, and for applications like redstone impulsator where you do not need the pc to be on all the time.
1 user(s) are reading this topic
0 members, 1 guests, 0 anonymous users











