Simple functions to detect changes in network connection status (using luasocket)