Inspirel banner

Programming Distributed Systems with YAMI4

6.1.1 TCP Listeners

The target for the TCP listener can be specified in one of several ways.

To create a listener with the target that corresponds to the predefined host name and port number (in other words, to use the deterministic target resolution approach described above) the following format should be used:

tcp://hostname:port

The resolved target name for such a listener will repeat both hostname and port values, with possible domain name resolution for the host name part.

Wildcards * can be used for both host name and port number to give some freedom to the operating system with respect to address and port allocation.

In the case of host name the wildcard means that the listening socket should be bound to the ``any'' address of the local machine, which is appropriate when incoming connections on different network interfaces are expected. The resolved target name will contain the name of local host in place of the wildcard.

If the wildcard is used instead of the port number then the port number will be assigned by the operating system. The resolved target name will contain the assigned port number in place of the wildcard.

For example, in order to establish a listener on the local loop with system-assigned port number, the server should use the following target name:

tcp://localhost:*

The shortest form of the TCP listener target name is:

tcp://*:*

Such a target means that the listening socket should be bound to ``any'' address and that the port number should be assigned by the system.