Class: |
DimClient |
Library: |
DIM |
|
Author: |
C. Gaspar |
|
Version: |
v1.0 |
Update :Thu Feb 11 15:52:46
1999 |
Descrition :
To be used by DIM clients - implements static
methods relating to the Client
Mainly Sending Commands to Servers.
The methods sendCommand(...) will wait for the
command to be actualy sent to the Server
and return a completion code of :
1 - if it was successfully
sent.
0 - if it couldn't be
delivered.
The exception beeing: if the user calls this
method inside a Handler (infoHandler, serviceHandler,
commandHandler
and clientExitHandler) the
command will be sent but without waiting for reception
and the return code is not reliable (in order
to avoid deadlocks).
The methods sendCommandNB(...) are Non Blocking, i.e. they do not wait for
the command to be sent.
They should be used inside callback routines to avoid deadlocks
Public Functions :
-
static void setDnsNode ( char * node_name) ; Sets the DNS node name
for a DIM client (the default DNS node name is taken from the environment
variable DIM_DNS_NODE).
-
static void setDnsNode ( char * node_name, int port_number) ; Sets the DNS node name
and port number for a DIM client (the default port number is 2505).
-
static char *getDnsNode ( ) ; Gets the DNS node name
defined for a DIM client.
-
static int getDnsPort ( ) ; Gets the DNS port number
defined for a DIM client.
- static int sendCommand ( char * name, int data)
; //Send Integer as Command
- static int sendCommand ( char * name, float
data) ; //Send Float as Command
- static int sendCommand ( char * name, double
data) ; //Send Double
- static int sendCommand ( char * name, short
data) ; //Send Short
- static int sendCommand ( char * name, longlong
data) ; //Send longlong (64 bit)
- static int sendCommand ( char * name, char
* data) ; // Send a Character String
- static int sendCommand ( char * name, void
* data, int datasize) ; //Send a structure or a vector
- static int sendCommandNB ( char * name, int data)
; //Send Integer as Command
- static int sendCommandNB ( char * name, float
data) ; //Send Float as Command
- static int sendCommandNB ( char * name, double
data) ; //Send Double
- static int sendCommandNB ( char * name, short
data) ; //Send Short
- static int sendCommandNB ( char * name, longlong
data) ; //Send longlong (64 bit)
- static int sendCommandNB ( char * name, char
* data) ; // Send a Character String
- static int sendCommandNB ( char * name, void
* data, int datasize) ; //Send a structure or a vector
- static setExitHandler
( char * serverName) ; //Inform the Server that this client would
like the Server to execute an ExitHandler when it dies.
- static addErrorHandler (DimErrorHandler *handler
) ; Instruct the Server to execute the virtual method errorHandler
whenever the DIM server sees an error. If no errorHandler is declared the DIM
server prints an error message.
Methods for Service Info Handling
-
virtual void infoHandler ( ) ; The method to
be overloaded by the user, DimClient can be used as a base class when the
user wishes to handle multiple DimInfo Services using the same handler. Example.
-
DimInfo* getInfo
( ) ; Can be used inside "infoHandler" in order to return a pointer
to the DimInfo service currently beeing handled.
Usage :
setExitHandler
Example
sendCommand Example:
main()
{
DimClient::sendComamnd("SRV/ALLOCATE", 1);
...
DimClient::sendCommand("SRV/ALLOCATE", 0);
}
Last update : 02/19/99 12:49:03 by MkHelp
1.1.0