Use of _any, _node and multiple NICs

Use of _any, _node and multiple NICs

book

Article ID: KB0085561

calendar_today

Updated On:

Products Versions
TIBCO SmartSockets -
Not Applicable -

Description

Resolution:
Using _any can be used in place of the node name in the RTserver's Conn_Names option to bind to all NICs in a machine.
Using _node can be used if you wish to bind to only the default NIC.
Using _node and _any on a machine with only one NIC is virtually equivalent. In place of _any or _node you can also use the NIC's address(s).
- - - - - - - - - - -
When creating a tcp server connection in SmartSockets 5.5 the IP address 0.0.0.0 (INADDR_ANY) was always used. This means that the server connection will listen on all IP addresses of the host machine for incoming connection requests. The node portion of the LCN was only used in verifying that it was the same as the value returned by gethostname() or RT_FORCE_NODE_NAME if set. In 5.5 "_node" mapped to the value returned by gethostname(), or RT_FORCE_NODE_NAME if set.
When creating a server connection in 6.0 the node portion of the LCN is now used to determine the IP address for binding. If the value "_node" is provided then the DNS-resolved IP address given by gethostname() or RT_FORCE_NODE_NAME is used. If the value "_any" is provided then the IP address 0.0.0.0 is used. On a machine with only one NIC, "_any" and "_node" are not exactly equivalent. With "_any" you'll be able to connect on the loopback address, 127.0.0.1 (if configured, which it typically is), as well as the machines IP address. With "_node" you'll only be able to connect on the machine's default IP address.
- - - - - - - - - - - -
Additional Information:
_node in SS6.x now maps to the default ip address of the machine. In SS5.x  _node mapped to 0.0.0.0 (listen on all IP addresses), which is the behavior of _any in SS6.x.   You can verify this by starting an RTserver and doing a netstat and observing the bound LISTENING tcp port. So, there is the potential for a slight difference in behavior on machines running with multiple NIC cards, specifically the conn_names that *RTclients* connect on should now be _any instead on _node.  The reason why we recommend that _any *not* be used for RTserver-to-RTserver connections is that if the connection is actually made on an interface other than the default, then at each server_reconnect_interval the server will think its not connected to the other server and will try to reconnect, which will fail since in reality it is already connected.
- - - - - - - - - - - - -
Example of using both _node & _any:
Since the use of the keyword _any is discouraged for RTserver to RTserver connections. Running RTserver with a conn_names containing both _node and _any interfaces as follows is the recommended approach. In the target RTserver's .cm file (the RTserver you want to connect to on machine foo) the entry would be:
     setopt conn_names tcp:_node:5105,tcp:_any:5101
tcp:_node:5105 is listening on the default device eth0. Other RTservers should connect here.
tcp:_any:5101 is listening on both device eth0 AND eth1. RTclients should connect here.

All RTclients should connect to tcp:foo:5101 and all RTservers should connect to tcp:foo:5105
A connecting RTserver's .cm server_names entries would be:
      setopt server_names tcp:foo:5105

A connecting RTclient's .cm server_names entries would be:
       setopt server_names tcp:foo:5101

Issue/Introduction

Use of _any, _node and multiple NICs