I’ve got a urllib setup POSTing data up to a remote server
The problem is how to handle when there is no connectivity to the internet.
I currently store data in a cString until there are x samples, then write them to flash if I lose connectivity.
The problem I have is telling if I have connectivity. There is no timeout for urllib and every other option I’ve tried doesn’t seem to work. The timeout seems to be 1.5-3 minutes or so which is too long to hang (I lose too much data samples).
I’ve tried to set socket.setdefaulttimeout but it doesn’t seem to work in my dia device driver (generates an errror about the socket object). I also put it in dia.py but it didn’t work either (no error, but also no affect).
I tried to add in a timeout via signal (which I’ve read isn’t very thread safe?) but couldn’t get it to add the signal module to the zip.
I looked at httplib, urllib2 etc… but they all seem to have the same issues.
Any other options to have a 10-15 second timeout on a connection?