Refactor ip4 address reading.
Properly parse hostnames.