Ping IP doesn't work - Printable Version +- Logic Machine Forum (https://forum.logicmachine.net) +-- Forum: LogicMachine eco-system (https://forum.logicmachine.net/forumdisplay.php?fid=1) +--- Forum: Scripting (https://forum.logicmachine.net/forumdisplay.php?fid=8) +--- Thread: Ping IP doesn't work (/showthread.php?tid=2189) |
Ping IP doesn't work - MantasJ - 08.08.2019 Hello, I am using this script: https://forum.logicmachine.net/showthread.php?tid=1035 to ping an IP adress of a laptop in the same network as the LM is. It somewhy does not work, I transformed script into this: Code: function socketping(ip, port, timeout) Thank You. RE: Ping IP doesn't work - Daniel - 08.08.2019 Log what error tells you. You need to check on which port you can access this PC. Most likely firewall blocks it. I tested it with another LM and the script itself works. RE: Ping IP doesn't work - admin - 08.08.2019 This is not standard ping. It tries to connect to port 80, so unless you have a web server running on laptop it will not work. Use this function instead: Code: function ping(ip) RE: Ping IP doesn't work - MantasJ - 08.08.2019 Thank You guys. I've tried the script, but now it always logs that the IP is connected even though it is on another network. I don't understand, if there is something I'm doing wrong? Here is the script: Code: function ping(ip) If I ping this IP from cmd the request times out and it is disconected, but if I run this script it says it is connected. Maybe I have to somehow decode the data from "res"? This is what logs gives me: Code: Ping IP 08.08.2019 11:04:40 RE: Ping IP doesn't work - Daniel - 08.08.2019 Correct your line 6 to this Code: ping=ping('192.168.100.222') RE: Ping IP doesn't work - MantasJ - 08.08.2019 Thank You Daniel, it works perfectly RE: Ping IP doesn't work - AlexLV - 22.04.2020 Hi, I want to use ping function for many IP check in one script, but how correctly to use function many times? I did this way but error.. Resident script:53: attempt to call global 'ping' (a boolean value) stack traceback: Error apear when I want to use function with other IP.. Code: function ping(ip) Alex RE: Ping IP doesn't work - admin - 23.04.2020 It does not work because you've set the result to variable with the same name as the function. So ping is no longer a function but boolean variable. Another thing is that if/else is not needed, you can pass the result directly to checkwrite: Code: function ping(ip) RE: Ping IP doesn't work - AlexLV - 23.04.2020 OK, Big thanks for correcting our mistakes ans possibility to learn right ways of LUA programming! Alex RE: Ping IP doesn't work - djaval - 24.04.2024 Hi All! The solution doesn't work on LSS100200. My script is follow: Code: function ping(ip) In error log I see this: Code: os.execute call blocked RE: Ping IP doesn't work - admin - 24.04.2024 Disable "Block unsafe functions in scripts" in Utilities > General configuration. |