Appendices > The MvTCP Communication Layer > Subclassing IlsTcpMvProcess
 
Subclassing IlsTcpMvProcess
You may want to subclass IlsTcpMvProcess to override the virtual member function lookupProcess. This function is called by Rogue Wave Server when the process attempts a connection to another process on the specified machine. The default behavior of this method is to request the logical mapper running on that machine to get the TCP port of the server process. If the method returns 0, the connection attempt fails.
To subclass IlsTcpMvProcess, write the following code:
class MyTcpProcess : public IlsTcpMvProcess
{
MyTcpProcess(unsigned short & port) : IlsTcpMvProcess(port) {
}
static IlsBoolean Initialize(int& argc,
char** argv,
unsigned short listenPort=0) {
MyTcpProcess* proc = new MyTcpProcess(listenPort);
return proc->initialize(argc, argv);
}
virtual IlsBoolean localInitialize(int& argc, char** argv) {
return IlsTcpMvProcess::localInitialize(argc, argv);
}
Then, call the Initialize function from the main function to create your own instance of the process:
int main(int argc, char* argv[]) {
MyTcpProcess::Initialize(argc, argv, 0);
 
}

Version 5.8
Copyright © 2014, Rogue Wave Software, Inc. All Rights Reserved.