Host Identification for TCP/IP and TLS
The TCP and TLS connectors support both the TCP4 (IPv4) and TCP6 (IPv6) protocols. The protocol used depends on the format of the IP address of the host, and how it is specified.
- The format of an TCP4 address is 4 number
separated by dots, 1.0.0.0 to 255.255.255.255, for example,
93.184.216.119
. - The format of an TCP6 IP address is up to eight
4-digit hexadecimal numbers separated by colons, for example,
2606:2800:220:6d:26bf:1447:1097:aa7
.
In Uniface connection strings, the HostId can be specified as a string version of the IP address, in which case the format determines the IP protocol.
More commonly, it is specified as Domain Name Server
(DNS) or Network Information Service (NIS), such as www.example.com
or
/example
.
Depending on the way the network and the local host are configured, an TCP4 or TCP6 address may be the only one available, or both types of address may be available.
Where a choice exists, you can define the preferred
protocol by setting the TCP/IP connector option prf to 4
or
6
. For example:
[DRIVER_SETTINGS] USYS$TCP_PARAMS prf=6
If the Host is not specified at
all, it is assumed to be localhost
Specifying the Protocol in Uniface Router
For the Uniface Router, there are a number of ways to specify the host and hence the protocol version.
- On the Uniface Router command line, it is
possible to specify up to 4 listening ports, using the path-style syntax
NetworkConnector
:
{HostID}{+
Port}, for example:urouter tcp:+13002 tcp:+13003 tls:+13004
When establishing the connection, the TCP connector attempts to discover how the local host is configured. If only a TCP4 address can be obtained, all the listening ports will be opened using the TCP4 protocol. Likewise, if only a TCP6 address is obtained, all the listening ports will be created using TCP6. If both addresses are available, the TCP connector option prf option (if specified) is used to determine which address will be used.
- In the $DEFAULT_NET
setting, which provides an alternative for all unspecified listening ports on the command line. For
example:
$DEFAULT_NET = TCP:abs012345+13005|||
The host identifier must be a valid name for the local machine. For example, it can be
localhost
. For more information, see $DEFAULT_NET. - In the $DEFAULT_TCP_HOST
setting. If the $DEFAULT_NET setting is not provided, the
$DEFAULT_TCP_HOST setting will be used.
If that is also not provided, the TCP connector will attempt to discover the IP addresses available for the local machine. For more information, see $DEFAULT_TCP_HOST.
The ability to provide host names on the command line means that a single Uniface Router can listen for both TCP4 and TCP6 requests. In this case, special consideration needs to be given to how clients and servers connect to it.
For example, the following Uniface Router command line listens on two ports on the local machine:
urouter tcp:172.12.12.16 tcp:fec0::af93:1+13002
- The first port is 13001 (the default port) using TCP4, because the host name is a TCP4-style IP address identifying the local machine.
- The second port is 13002, created using TCP6, because the host name is a TCP6-style IP address identifying the local machine.
If a client attempts to connect to the Uniface
Router using TCP6 without specifying a port, it will fail because the default port is 13001 and the
Uniface Router is listening on port 13001 using TCP4; if a client uses port 13001, it must use
TCP4. When the Uniface Router starts a server, it will provide a /dnp switch on
the server command line, /dnp=tcp:172.12.12.16
, because that is the specification
of the first listening port. The Uniface Server will connect to the Uniface Router using that
address, and hence using TCP4. For more information, see /dnp.
ANY Addresses
The following addresses can be used to specify listening ports in the Uniface Router:
0.0.0.0
— TCP4 ANY address::
— TCP6 ANY address
On Unix::
address causes
the TCP connector to listen for both TCP6 and TCP4 on the same port. The Uniface Router sees the
connection as a TCP6 connection, whereas a client using TCP4 to connect to the port sees the
connection as a TCP4 connection.