Fix python3 issues
Use socket logic to determine proper number of threads for upload