Catch and print socket errors.