if there is a socket error with the connection while uploading data, handle it properly.