Use getsockopt to extract better failure condition when tcp layer receives a failure