Universal Messaging Realm servers provide the ability for connections to be made using any available physical network interface on the server machine. For example, if a machine has 4 physical network interfaces, Universal Messaging provides the ability to bind specific network interface addresses to specific ports and different protocols. This provides the ability to run segment the communication between client and server. There is no limit to the number of separate interfaces that can be run on a Universal Messaging realm server.
For example, a Realm Server that is visible to Internet users may have 4 Network cards, each one having its own physical IP address and hostname. Two of the network interfaces may be externally visible, while the other 2 may be only visible on internal sub-nets.
The 2 external interfaces may be specified as using nhp, and nhps on ports 80 and 443 respectively, since for firewall purposes, these ports are the most commonly accessible ports to external clients connecting to the realm. The remaining internal interfaces, visible to internal client connections do not have the same restrictions, and so could be defined as using nsp and nsps protocols on other ports, say 9000 and 9002 respectively.
What this guarantees is separation of internal and external connections based on network interface and protocol.
When you have connected to a realm, and have a reference to an nRealmNode object (see nRealmNode
), you can access an object called nInterfaceManager, which provides the ability to add, modify, delete, stop and start interfaces on the Universal Messaging realm. To get access to this object, you can call the following method from a realm node:
nInterfaceManager iMgr = realm.getInterfaceManager();
nInterfaceManager* iMgr = realm->getInterfaceManager();
Using the nInterfaceManager object you can then obtain a list of known interfaces for that realm:
Vector ifaces = iMgr.getInterfaces();
List ifaces = iMgr.getInterfaces();
int numInterfaces; nInterfaceStatus** pTemp = iMgr->getInterfaces(numInterfaces);
All interfaces extend a base class called nInterface. There are 4 types of interface object that correspond to the different types of protocols that an interface can use. These are:
nSocketInterface - standard socket interface, Universal Messaging protocol is nsp
nHTTPInterface - http interface, Universal Messaging protocol is nhp
nSSLInterface - ssl socket interface, Universal Messaging protocol is nsps
nHTTPSInterface - https interface, Universal Messaging protocl is nhps
Each of these interface objects contain standard configuration information and allows the same operations to be performed on them. For example, if there is an interface called 'nsp1', and you wanted to change the 'autostart' property to true (i.e. make the interface start automatically when the realm is started) this can be achieved with the following code:
nInterface iface = iMgr.findInterface("nsp0");
nInterface* iface = iMgr->findInterface("nsp0");
Which will modify the interface configuration at the server, stop and restart the interface. When performing a modInterface operation, if you are modifying the interface that your nRealmNode is connected to, you will be disconnected and reconnected when the interface restarts. This is important to remember when using the stop method of an interface too, since if you stop the interface you are connected to, you cannot start it again, since your connection needs to be active, and the stop operation will close your connection. If you wish to restart an interface you should therefore do it from a connection which has been made via another interface.
Example: creating an NHPS interface
You can create an NHPS interface using code such as the following:
nRealmNode rnode = ...;
nHTTPSInterface nhps = new nHTTPSInterface("0.0.0.0", 9443,