This class lets you initialize a server or a component process that uses Rogue Wave Server MvTCP as its communication layer. More...
#include <ilserver/mvtcp/tcpmvproc.h>
Public Member Functions | |
virtual IlsBoolean | processRequest (IlsTime *t) |
Called by the function IlsMvServer::Run() to execute a request issued by a component. More... | |
Public Member Functions inherited from IlsMvProcess | |
IlsMvProcess () | |
Constructor. More... | |
virtual | ~IlsMvProcess () |
The instance of IlsMvProcess is automatically destroyed by Rogue Wave Server when the process ends. | |
IlsMvEndPoint *const * | getEndPoints (int &dim) |
Returns an array of all the end points created in the process. More... | |
virtual void | beforeRequest () |
Called by the subclass of IlsMvProcess before it a request received on the communication layer is processed. More... | |
virtual void | afterRequest () |
Called by the subclass of IlsMvProcess after a request received on the communication layer has been processed. More... | |
Static Public Member Functions | |
Initialization | |
static IlsBoolean | Initialize (int &argc, char **argv, unsigned short listenPort=0) |
Use this static member function to initialize MvTCP, the Rogue Wave Server TCP/IP communication layer. More... | |
static unsigned short | GetListenPort () |
This static member function returns the port used to accept new connections. More... | |
static void | HideSendingErrors (IlsBoolean b) |
This static member function should be called after Initialize() . More... | |
Buffers | |
static void | SetDefaultRecvBuffer (int size) |
Set the default size of the receive buffer used by the sockets. More... | |
static int | GetDefaultRecvBuffer () |
Get the default size of the receive buffer used by the sockets. More... | |
static void | SetDefaultSendBuffer (int size) |
Set the default size of the send buffer used by the sockets. More... | |
static int | GetDefaultSendBuffer () |
Get the default size of the send buffer used by the sockets. More... | |
Timeout | |
static IlsTime * | GetTcpTimeout () |
Get the default timeout for synchronous calls. More... | |
static void | SetTcpTimeout (IlsTime *timeout) |
Set the default timeout for synchronous calls. More... | |
static void | SetTcpNoDelay (IlsBoolean b=IlsTrue) |
Set the TCP_NO_DELAY option for sockets. More... | |
static IlsBoolean | IsTcpNoDelay () |
Check if socket layer has been initialized with the TCP_NO_DELAY option. More... | |
Communication with the Logical Mapper | |
static IlsTcpdMapping * | GetMappings (IlsString const &hostName, int &size, unsigned short port=0, IlsTime *timeout=0) |
Returns all the mappings registered on a Rogue Wave Server logical mapper. More... | |
static int | PingDaemon (IlsString const &hostName, unsigned short port=0, IlsTime *timeout=0) |
This static member function is used to know whether a Rogue Wave Server logical mapper is alive. More... | |
Trace | |
static void | SetTrace (IlsBoolean b=IlsTrue) |
Set the trace mode for the MvTCP layer. More... | |
static IlsBoolean | IsTraced () |
Check if the trace mode for the MvTCP layer is enabled. More... | |
File Descriptors | |
static IlsBoolean | AddInput (IlsFD fd, IlsSocketCallback cb, IlsAny arg=0) |
Register external file descriptors with the Rogue Wave Server MvTCP main loop. More... | |
static IlsBoolean | RemoveInput (IlsFD fd) |
Unregister an external file descriptor from the Rogue Wave Server MvTCP main loop. More... | |
static void | ProcessFD (IlsFD fd) |
Call this static member function when you have registered MvTCP file descriptors with an external main loop and detected an event through the select() system call on this file descriptor. More... | |
static void | SetCreateFDCallback (IlsSocketCallback cb, IlsAny arg=0) |
This static member function registers a callback that will be called each time a new MvTCP file descriptor must be registered with an external main loop. Call this function after having initialized the MvTCP layer using the Initialize function. More... | |
static void | SetRemoveFDCallback (IlsSocketCallback cb, IlsAny arg=0) |
This static member function registers a callback that will be called each time MvTCP releases a file descriptor. If you have registered the MvTCP file descriptor passed to the callback with an external main loop, you must unregister it when the callback is called. More... | |
Static Public Member Functions inherited from IlsMvProcess | |
static IlsMvProcess * | GetSingletonPtr () |
Returns the single instance of IlsMvProcess that has been initialized or 0 if none has been initialized. More... | |
static IlsBoolean | SetName (const IlsString &name) |
Assigns a name to the current process to enable distributed applications to connect to the process. More... | |
static IlsString | GetName () |
Returns the name assigned to the process or by default the null string. | |
static IlsBoolean | Initialize (int &argc, char **argv) |
Initializes a linked Server process – that is, a process including both server and component(s). More... | |
static IlsBoolean | IsInitialized () |
Returns IlsTrue if the process has already been initialized or IlsFalse otherwise. | |
static IlsMvEndPoint * | GetEndPoint (const IlsString &procName, const IlsString &hostName, IlsBoolean isComp) |
Returns a pointer to the local end point of the connection established with the process procName on host hostName. More... | |
static IlsMvComponent * | GetComponent (const IlsString &serverName, const IlsString &hostName) |
Similar to the function GetEndPoint() , except that it explicitly looks for a component connected to the server named serverName on host hostName. | |
static IlsMvEndPoint * | Connect (const IlsString &actorName, const IlsString &hostName, const IlsString &myIPAddr=IlsString::Null, IlsBoolean toServer=IlsTrue) |
Enables connection to the process procName running on the host hostName. More... | |
static int | DoConnect () |
Executes the connection to the server(s) specified in the command line using one of the -ilsc or -ilsconnect options. More... | |
static IlsBoolean | DisconnectOnComError () |
Returns the value of the disconnectOnError property. More... | |
static void | SetDisconnectOnComError (IlsBoolean b) |
Sets the value of the disconnectOnError property. | |
static IlsBoolean | Run (int nb=0, IlsTime *t=0) |
Iimplements the default event loop for dynamic-view based processes. More... | |
static IlsBoolean | ProcessRequest (IlsTime *t) |
Calls the virtual function processRequest() on the IlsMvProcess singleton. | |
static void | Stop () |
Stops the Run() event loop. | |
Protected Member Functions | |
IlsTcpMvProcess (unsigned short &port) | |
This protected constructor is called by the static member function Initialize or by the constructor of a subclass with the listen port as its argument. More... | |
virtual IlsTcpdMapping * | getMappings (IlsString const &hostName, int &size, unsigned short port=0, IlsTime *timeout=0) |
You can override this virtual member function to define your own implementation, that is, to return a list of predefined mappings without connecting to a Rogue Wave Server logical mapper. More... | |
virtual IlsBoolean | localInitialize (int &argc, char **argv) |
Invoked by the member function initialize. More... | |
virtual unsigned short | lookupProcess (const IlsString &procName, const IlsString &hostName) |
By default, this virtual member function request the logical mapper running on hostName to get the TCP port of the server process. More... | |
virtual void | onError (const IlsString &msg, IlsSocketException *e=0, IlsBoolean sendingError=IlsFalse) |
Invoked by Rogue Wave Server each time an exception is trapped inside the MvTCP communication layer or each time an error occurs when the connection is manipulated. More... | |
virtual void | onTcpError (const IlsString &msg) |
Is invoked by Rogue Wave Server when a low-level error occurs in the MvTCP communication layer. More... | |
virtual int | pingDaemon (IlsString const &hostName, unsigned short port=0, IlsTime *timeout=0) |
You can override this virtual member function to define your own implementation. More... | |
Protected Member Functions inherited from IlsMvProcess | |
virtual IlsBoolean | initialize (int &argc, char **argv) |
Initializes an instance of IlsMvProcess . More... | |
This class lets you initialize a server or a component process that uses Rogue Wave Server MvTCP as its communication layer.
Library: mvtcp
For processes that use both Rogue Wave Server and Rogue Wave Views, you must use the class IlsIlvTcpMvProcess
. The MvTCP communication layer is based on TCP/IP sockets and is available both in C++ and Java.
This class is also used to communicate with the Rogue Wave Server logical mapper to retrieve logical mappings.
|
protected |
This protected constructor is called by the static member function Initialize or by the constructor of a subclass with the listen port as its argument.
The listen port is the port used to accept new connections. If the listen port is 0, Rogue Wave Server automatically selects an available port and assigns it to the port argument.
port | listen port |
|
static |
Register external file descriptors with the Rogue Wave Server MvTCP main loop.
When an event is detected on this file descriptor by the select()
system call, Rogue Wave Server calls the corresponding callback with the provided argument arg.
fd | file descriptor to add |
cb | socket callback |
arg | user argument |
IlsTrue
if the file descriptor has been successfuly added.
|
static |
Get the default size of the receive buffer used by the sockets.
|
static |
Get the default size of the send buffer used by the sockets.
|
static |
This static member function returns the port used to accept new connections.
|
static |
Returns all the mappings registered on a Rogue Wave Server logical mapper.
The logical mapper is identified by the name of the machine on which it is running (the hostName
parameter) and, optionally, by a port number. If the port number is equals to 0 the default port number is used. You can specify a timeout because this call is synchronous. If no timeout is specified it a blocking call (infinite timeout).
The return value is an IlsTcpdMapping
array, whose size is returned in the size parameter.
hostName | host name of the logical mapper |
size | receive size of the returned array |
port | logical mapper's port (0 for default port) |
timeout | timeout (0 if no timeout) |
delete []
.
|
protectedvirtual |
You can override this virtual member function to define your own implementation, that is, to return a list of predefined mappings without connecting to a Rogue Wave Server logical mapper.
See the static member function GetMappings()
.
hostName | host name of the logical mapper |
size | receive size of the returned array |
port | logical mapper's port (0 for default port) |
timeout | timeout (0 if no timeout) |
delete []
.
|
static |
Get the default timeout for synchronous calls.
|
static |
This static member function should be called after Initialize()
.
It allows you to hide sending errors when the remote components has been deleted and before the disconnection is handled.
b | IlsTrue for hiding errors. |
|
static |
Use this static member function to initialize MvTCP, the Rogue Wave Server TCP/IP communication layer.
The listenPort argument can be used to specify on which TCP port the process will listen to incoming messages.
argc | the argc received by main() function. |
argv | the argv received by main() function. |
listenPort | listen port |
IlsTrue
if initialization succeeded, IlsFalse
otherwise.
|
static |
Check if socket layer has been initialized with the TCP_NO_DELAY
option.
IlsTrue
if the socket layer has been initialized with the TCP_NO_DELAY
option on the platforms that supports it.
|
static |
Check if the trace mode for the MvTCP layer is enabled.
IlsTrue
if trace mode is enabled.
|
protectedvirtual |
Invoked by the member function initialize.
It takes the arguments of the command line as its parameters. It has an empty body but is overridden in subclasses of IlsMvProcess
.
Reimplemented from IlsMvProcess.
Reimplemented in IlsIlvTcpMvProcess.
|
protectedvirtual |
By default, this virtual member function request the logical mapper running on hostName to get the TCP port of the server process.
It is called by Rogue Wave Server when the process attempts a connection to another process, named procName, on the machine hostName. If the method returns 0, the connection attempt fails.
procName | server name |
hostName | host name on which the server runs. |
|
protectedvirtual |
Invoked by Rogue Wave Server each time an exception is trapped inside the MvTCP communication layer or each time an error occurs when the connection is manipulated.
See section Subclassing IlsTcpMvProcess in Appendix E of Rogue Wave Server User's Guide to learn how to override this method to trap MvTCP errors. The default behavior is to log a error message prefixed by MvTCP:
.
IlsTrue
. In this case, no error message is logged in the default implementation if the method HideSendingErrors()
has been invoked on the process.msg | error message |
e | exception if any |
sendingError | IlsTrue if error occurs when messages of generic protocol are sent. |
|
protectedvirtual |
Is invoked by Rogue Wave Server when a low-level error occurs in the MvTCP communication layer.
By default, an error message prefixed by MvTCP (TCP):
is logged.
msg | error message |
|
static |
This static member function is used to know whether a Rogue Wave Server logical mapper is alive.
The logical mapper is identified by the name of the machine on which it is running (the hostName parameter) and, optionally, by a port number. You can specify a timeout value because this call is synchronous. If no timeout is specified, it is a blocking call (infinite timeout).
hostName | host name of the logical mapper |
port | logical mapper's port (0 is the default port) |
timeout | timeout (0 if no timeout) |
|
protectedvirtual |
You can override this virtual member function to define your own implementation.
See the static member function PingDaemon()
.
hostName | host name of the logical mapper |
port | logical mapper's port (0 is the default port) |
timeout | timeout (0 if no timeout) |
|
static |
Call this static member function when you have registered MvTCP file descriptors with an external main loop and detected an event through the select()
system call on this file descriptor.
fd | file descriptor to process |
|
virtual |
Called by the function IlsMvServer::Run()
to execute a request issued by a component.
This method returns IlsFalse
if a timeout has been set (t parameter != 0) and has expired before an event has been received on the communication layer, or if a low-level exception is raised by the communication layer. In this case, an error message is issued.
t | timeout (0 for no timeout) |
IlsFalse
if timeout expires before an event has been received or if an exception has been catched. Reimplemented from IlsMvProcess.
|
static |
Unregister an external file descriptor from the Rogue Wave Server MvTCP main loop.
fd | file descriptor to remove |
IlsTrue
if the file descriptor has been successfuly removed.
|
static |
This static member function registers a callback that will be called each time a new MvTCP file descriptor must be registered with an external main loop. Call this function after having initialized the MvTCP layer using the Initialize function.
You must call the member function ProcessFD()
when the external main loop has detected an event on this file descriptor through the select()
system call. When this function is called, Rogue Wave Server will immediately trigger the callback you provided for the listen file descriptor of MvTCP.
cb | callback to be called |
arg | user argument |
|
static |
Set the default size of the receive buffer used by the sockets.
size | buffer size |
|
static |
Set the default size of the send buffer used by the sockets.
size | buffer size |
|
static |
This static member function registers a callback that will be called each time MvTCP releases a file descriptor. If you have registered the MvTCP file descriptor passed to the callback with an external main loop, you must unregister it when the callback is called.
cb | callback to be called |
arg | user argument |
|
static |
Set the TCP_NO_DELAY
option for sockets.
This option is set by default on the platforms that supports it.
b | IlsTrue to set the TCP_NO_DELAY option. |
|
static |
Set the default timeout for synchronous calls.
timeout | new default timeout |
|
static |
Set the trace mode for the MvTCP layer.
b | IlsTrue to set traces. IlsFalse for no trace. |