Fix connecting to IPv6 only (AAAA only) IRC servers

Do a lookup before creating sockets, so tcp6 is used if there is a AAAA record. This fixes not being able to connect to e.g. irc6.quakenet.org and similar AAAA only hostnames.