I've wrote a plugin which talks to SonOff S20 appliance modules (and other IP enabled devices).
For the most part, this all works flawlessly.
However, it runs into an issue if the device is offline/unplugged etc.
The OSA scripting will hang for 20 seconds, eventually put the error below in the log and then continue.
Now I assume there are 2 ways to solve this:System.Net.Sockets.SocketException (0x80004005): A connection attempt failed because the connected party did not properly respond after a period of time or established connection failed because connected host has failed to respond 192.168.0.72:80 at System.Net.Sockets.TcpClient..ctor(String hostname, Int32 port) at OSAE.ThorianWiFi.THORIANWIFI.Connect(String server, String message)
1. Change the timeout from 20 seconds to say, 5?
I have no idea how to do this.
2. Make the plugin code multi threaded?
I have looked into this for days, maybe even weeks online, but cannot for the life of me figure out how to code it.
For info, my code is written in Visual Basic which I've attached. If anyone can solve this, I will be eternally grateful.