It means that your given host name ' ' is invalid (gai stands for getaddrinfo()).
' '
getaddrinfo()
As NPE already states, maybe an empty string '' would be more appropriate than a space ' '.
''
The
HOST = ' '
should read
HOST = ''
(i.e. no space between the quotes).
The reason you're getting the error is that ' ' is not a valid hostname. In this context, '' has a special meaning (it basically means "all local addresses").