Fix IP address bug

use gethostbyname(gethostname()) to get the IP address instead ‘’ and
’127.0.0.1’