linkend="libpq-multiple-hosts"/> for details.
</para>
</listitem>
</varlistentry>
<varlistentry id="libpq-connect-hostaddr" xreflabel="hostaddr">
<term><literal>hostaddr</literal></term>
<listitem>
<para>
Numeric IP address of host to connect to. This should be in the
standard IPv4 address format, e.g., <literal>172.28.40.9</literal>. If
your machine supports IPv6, you can also use those addresses.
TCP/IP communication is
always used when a nonempty string is specified for this parameter.
If this parameter is not specified, the value of <literal>host</literal>
will be looked up to find the corresponding IP address — or, if
<literal>host</literal> specifies an IP address, that value will be
used directly.
</para>
<para>
Using <literal>hostaddr</literal> allows the
application to avoid a host name look-up, which might be important
in applications with time constraints. However, a host name is
required for GSSAPI or SSPI authentication
methods, as well as for <literal>verify-full</literal> SSL
certificate verification. The following rules are used:
<itemizedlist>
<listitem>
<para>
If <literal>host</literal> is specified
without <literal>hostaddr</literal>, a host name lookup occurs.
(When using <function>PQconnectPoll</function>, the lookup occurs
when <function>PQconnectPoll</function> first considers this host
name, and it may cause <function>PQconnectPoll</function> to block
for a significant amount of time.)
</para>
</listitem>
<listitem>
<para>
If <literal>hostaddr</literal> is specified without <literal>host</literal>,
the value for <literal>hostaddr</literal> gives the server network address.
The connection attempt will fail if the authentication
method requires a host name.
</para>
</listitem>
<listitem>
<para>
If both <literal>host</literal> and <literal>hostaddr</literal> are specified,
the value for <literal>hostaddr</literal> gives the server network address.
The value for <literal>host</literal> is ignored unless the
authentication method requires it, in which case it will be
used as the host name.
</para>
</listitem>
</itemizedlist>
Note that authentication is likely to fail if <literal>host</literal>
is not the name of the server at network address <literal>hostaddr</literal>.
Also, when both <literal>host</literal> and <literal>hostaddr</literal>
are specified, <literal>host</literal>
is used to identify the connection in a password file (see
<xref linkend="libpq-pgpass"/>).
</para>
<para>
A comma-separated list of <literal>hostaddr</literal> values is also
accepted, in which case each host in the list is tried in order.
An empty item in the list causes the corresponding host name to be
used, or the default host name if that is empty as well. See
<xref linkend="libpq-multiple-hosts"/> for details.
</para>
<para>
Without either a host name or host address,
<application>libpq</application> will connect using a local
Unix-domain socket; or on Windows, it will attempt to connect to
<literal>localhost</literal>.
</para>
</listitem>
</varlistentry>
<varlistentry id="libpq-connect-port" xreflabel="port">
<term><literal>port</literal></term>
<listitem>
<para>
Port number to connect to at the server host, or socket file
name extension for Unix-domain
connections.<indexterm><primary>port</primary></indexterm>
If multiple hosts