'SocketException: Connection failed (OS Error: Machine is not on the network, errno = 64)

I am trying to connect to an IoT device that has no connection and then doing some http requests. but the device doesn't recognise the method get, and I got the error on the title, any ideas what is happening here ? I know that the error is correct, since my iot device has no connection, but how to do a request on local device network without connection ? if you have any solution for that please ..



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source