Issue #6 - Handle socket errors in upload and api. Allow setting timeout length externally