Fixed build error caused by overloading socket call on CentOS 5.

Review: https://reviews.apache.org/r/28854