Dynamic View Services > Implementing a Dynamic View Server and its Components > Initializing and Running a View Server > Distributed View Server
 
Distributed View Server
In most cases, Rogue Wave® Server applications are distributed applications involving a dynamic view server and several application components. Also, Rogue Wave Server is usually combined with a communication layer.
In Rogue Wave Server applications, components can be implemented in C++ or JavaTM. The communication layer should provide interoperability between these two languages. Communication between the dynamic view server and its components relies on a simple message-based protocol that can be implemented on various communication layers.
Rogue Wave Server provides its own communication layer, named MvTCP and based on TCP/IP sockets available on all platforms, both in C++ and JavaTM. A port of the Rogue Wave Server generic protocol is also available, as a contribution, on top of a CORBA communication layer, such as IONA Orbix© or Inprise VisiBroker©.
A view server for a distributed application using the MvTCP communication layer should initialize and run its execution loop like this:
include <ilserver/mvtcp/tcpmvproc.h>
#include <ilserver/mvserver.h>
int main(int argc, char **argv)
{
if (!IlsTcpMvProcess::Initialize(argc,argv)
|| !IlsMvServer::Initialize(argc,argv)){
cerr << "Initialization of server failed" << endl;
return 1;
}
...
IlsMvServer::Run();
}
In this case, the server executable must be loaded with the libraries mvserver, server, mvtcp, and ilog.
Note: On Windows®, when using the DLL versions of the mvtcp.lib library, you must link with the libraries svtcp.lib or mvtcp.lib, depending on whether you are linking a server or a component. This is necessary because it is not possible to have one DLL that can link with either mvserver.lib or mvcomp.lib.
Using a CORBA Object Request Broker instead of the default communication layer is only a matter of changing an include file, the initialization call, and the linked libraries. For example, if you choose Orbix, write:
#include <ilserver/mvcorba/omvproc.h>
#include <ilserver/mvserver.h>
 
int main(int argc, char **argv)
{
if (!IlsOrbixMvProcess::Initialize(argc,argv)
|| !IlsMvServer::Initialize(argc,argv)){
cerr << "Initialization of server failed" << endl;
return 1;
}
...
IlsMvServer::Run();
}
As shown in that code sample, the library mvtcp is replaced by the mvorbix and Orbix libraries in the linking instruction.
Naming a Distributed Server
A distributed dynamic view server must be associated with a name. This name will be used by remote components to connect to that server. This name is implicitly registered by Rogue Wave Server at the level of the communication layer.
There are two ways of giving a server a name.
*An easy way is to pass that name as an argument to the command line, like this:
myserver -ilsn myServerName ...
*Another way consists in calling the static function IlsMvProcess::SetName in your executable before initializing the process itself. For instance:
#include <ilserver/mvtcp/tcpmvproc.h>
#include <ilserver/mvserver.h>
int main(int argc, char **argv)
{
IlsMvProcess::SetName("myServerName");
if (!IlsTcpMvProcess::Initialize(argc,argv)
|| !IlsMvServer::Initialize(argc,argv))
...
}

Version 6.3
Copyright © 2018, Rogue Wave Software, Inc. All Rights Reserved.