Instead of using inet_addr we should probably use inet_pton here, and check for if it returns an error.