IGLib  1.7.2
The IGLib base library for development of numerical, technical and business applications.
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Events Macros
IG.Lib.NamedPipeClientBase Class Reference

Client to the pipe server (classes derived from IpcStreamClientServerBase2). More...

+ Inheritance diagram for IG.Lib.NamedPipeClientBase:
+ Collaboration diagram for IG.Lib.NamedPipeClientBase:

Public Member Functions

 NamedPipeClientBase (string pipeName)
 Constructs a new named pipe client with the specified pipe name, default server address (DefaultServerAddress) and default values for other paramters. More...
 
 NamedPipeClientBase (string pipeName, string serverAddress)
 Constructs a new named pipe client with the specified pipe name, server address (DefaultServerAddress) and default values for other paramters. More...
 
 NamedPipeClientBase (string pipeName, string serverAddress, string requestEnd, string responseEnd, string errorBegin)
 Constructs a new named pipe client with the specified pipe name, server address (DefaultServerAddress) and other paramters. More...
 
override void ClosePipe ()
 Closes the Server's pipe and the associated streams. More...
 
override bool IsConnected ()
 Returns true if server pipe is connected, . More...
 
override void Connect (double timeOutSeconds=0)
 Connects with the server. More...
 
override string ToString ()
 Returns a stirng containing the server data. More...
 
- Public Member Functions inherited from IG.Lib.IpcStreamClientBase
override void CloseInput ()
 Closes the inpt stream. More...
 
override void CloseOutput ()
 Closes the outut stream. More...
 
string GetServerResponse (string requestString)
 Sends a request to the server and returns its response. More...
 
override void ClearData ()
 Clears all the data related to servig requests (i.e. request and response strings, error flags, exceptions, etc.). More...
 
- Public Member Functions inherited from IG.Lib.IpcStreamClientServerBase2
virtual bool IsErrorResponse (string responseString)
 Returns true if the specified response string represents an error response (exception), false if not. More...
 
virtual string GetErrorMessage (string responseString)
 Returns error message that corresponds to the specified response string. More...
 
- Public Member Functions inherited from IG.Lib.IpcStreamClientServerBase
delegate string ResponseDelegate (string request)
 Provides an answer string to the specified request string. More...
 
void SetMessagePreix (string messagePrefix)
 Changes message prefix for the current object. More...
 
void messageSeparator (char messageSeparator)
 Changes message separator for the current object. More...
 
void SetMessageFalseSeparator (char messageFalseSeparator)
 Changes message false separator for the current object. More...
 
string CreateMessage (string messageName, string[] messageArguments)
 Creates a built-in message (possibly with arguments) that is to be interpreted directly by the receiver (stream client or server) and is not executed via ordinary path. More...
 
string CreateResponseOrRequestString (string originalResponseOrRequestString, bool multiLine)
 Generates request and response string in such a way that it can not be mixed up with a message. More...
 
void InterpretRequestOrResponseLine (ref string responseOrRequestString, out bool isMessage, out string messageOrCommandName, out string[] messageArguments)
 Returns the (eventually decoded) request or response string corresponding to the stirng that is read form the communication pipeline, and also parameters that specify whether the request string represents a message or not. Eventual command or message parameters are also returned. More...
 
void WriteMessage (StreamWriter outputStream, string message, string[] args)
 Writes a mesage to the output stream. What is written is decorated message (including the standard message prefix and separator) and message arguments. More...
 
virtual void WorkMessage (string messageName, string[] messageArguments, IpcStage context, ref bool worked)
 
virtual void RespondToMessage (string messageName, string[] messageArguments, ref bool responded)
 Responds to a received message. More...
 

Protected Member Functions

override void CloseConnection ()
 Closes the server pipe. More...
 
virtual void Connect (NamedPipeClientStream pipe, double timeOutSeconds=0)
 Connects the specified pype with the server. More...
 
- Protected Member Functions inherited from IG.Lib.IpcStreamClientBase
virtual string GetErrorMessage (Exception ex)
 Returns error message corresponding to the specified exception. More...
 
virtual void SendRequest (string requestString)
 Send specified request to server through a named pipe. More...
 
virtual void SendRequest ()
 Sends the current request string (the IpcStreamClientServerBase2.RequestString property) to the server through a named pipe. More...
 
virtual string ReadResponse ()
 Reads response from the server and stores it. More...
 

Properties

override string Name [get, set]
 Client name. The same as pipe name. More...
 
string PipeName [get, set]
 
static string DefaultServerAddress [get, set]
 Default server address. Setting to null sets it to "." (i.e. the local machine). More...
 
string ServerAddress [get, set]
 Server address. More...
 
NamedPipeClientStream ClientPipe [get, protected set]
 Named pipe used for communication by the server. More...
 
override StreamReader InputStream [get, protected set]
 Input stream of the server's named pipe. More...
 
override StreamWriter OutputStream [get, protected set]
 Output stream of the server's named pipe. More...
 
- Properties inherited from IG.Lib.IpcStreamClientBase
bool IsResponseReceived [get, protected set]
 Auxiliary flag telling whether response to a request has already been received from the server. Used for synchronization of diffeeent parts of the request sending process, which enables e.g special handling of Exceptions. More...
 
- Properties inherited from IG.Lib.IpcStreamClientServerBase2
abstract string Name [get, set]
 
static string DefaultPipeName [get, set]
 Default pipe name. More...
 
static string DefaultErrorBegin [get]
 Default string that begins an error report. More...
 
string ErrorBegin [get, protected set]
 
abstract StreamReader InputStream [get, protected set]
 Input stream writer of the server's named pipe. More...
 
abstract StreamWriter OutputStream [get, protected set]
 Output stream reader of the server's named pipe. More...
 
bool IsError [get, protected set]
 
string RequestString [get, protected set]
 The last request string that was read from the pipe. More...
 
string ResponseString [get, protected set]
 The last answer string that was written to the pipe. More...
 
Exception LastException [get, protected set]
 Returns the last exception thrown when serving request. More...
 
string LastErrorMessage [get, protected set]
 Returns the last error message. More...
 
string LastRequestString [get, protected set]
 Returns the last request string. More...
 
string LastResponseString [get, protected set]
 Returns the last response string. More...
 
- Properties inherited from IG.Lib.IpcStreamClientServerBase
object Lock [get]
 Objectt for locking the current object. More...
 
static object LockGlobal [get]
 Static lock object used by all instances of this class (and possibly by other classes). More...
 
StringBuilder StringBuilderInternal [get]
 
static int DefaultOutputLevel [get, set]
 Default level of output for this kind of class. More...
 
virtual int OutputLevel [get, set]
 Level of output generated by operatins. More...
 
static string DefaultMessagePrefix [get, set]
 
static char DefaultMessageSeparator [get, set]
 
static char DefaultMessageFalseSeparator [get, set]
 
string MessagePrefix [get, protected set]
 
char MessageSeparator [get, protected set]
 
char MessageFalseSeparator [get, protected set]
 
string MessagePrefixWithSeparator [get, protected set]
 Gets the mesage prefix with separator. If some string is a message, everything that follows this string until the first separator is a message name. More...
 
static string DefaultMsgRequestBegin [get]
 Default message that begins any mulltiline request. More...
 
static string DefaultMsgRequestEnd [get]
 Default message that ends any mulltiline request. More...
 
static string DefaultMsgResponseBegin [get]
 Default message that begins any multiline response. More...
 
static string DefaultMsgResponseEnd [get]
 Default message that ends any multiline response. More...
 
static string DefaultMsgTestSquare [get]
 Default message that requests a test computation of square to be performed on the other side (a sort of ping command). More...
 
static string DefaultMsgTestSpeed [get]
 Default message that requests a speed test to be performed on the other side (a sort of ping command). More...
 
string MsgRequestBegin [get, protected set]
 
string MsgRequestEnd [get, protected set]
 
string MsgResponseBegin [get, protected set]
 Message that begins any multiline response (only when multiline responses are allowed). More...
 
string MsgResponseEnd [get, protected set]
 Message that ends any multiline response (only when multiline responses are allowed). More...
 
string MsgTestSquare [get, protected set]
 Message that requests square of its argument to be sent back. Used as a kind of verifiable ping. More...
 
string MsgTestSpeed [get, protected set]
 Message that requires a kind of speed test to be performed on the other side. More...
 
static string DefaultStopRequest [get, set]
 Default stop request string - request string that will stop the server. More...
 
string StopRequest [get, set]
 Request that causes the server stop listening and closing the pipe. More...
 
static string DefaultGenericResponse [get, set]
 Default generic response (sent in absence of any other method to generate the response). More...
 
string GenericResponse [get, protected set]
 Generic response that is sent back to the client in abscence of any method generating responses to specific requests. More...
 
static string DefaultStoppedResponse [get, set]
 Default stopped response (sent after the srver has sttopped on request). More...
 
string StoppedResponse [get, protected set]
 Stopped response that is sent back to the client after the server stops on its request. More...
 
static bool DefaultIsMultilineResponse [get]
 Default pipe name. More...
 
static bool DefaultIsMultilineRequest [get]
 Default pipe name. More...
 
virtual bool IsMultilineRequest [get, protected set]
 Whether or not multi line requests are allowed. More...
 
virtual bool IsMultilineResponse [get, protected set]
 Whether or not multi line responses are allowed. More...
 
- Properties inherited from IG.Lib.ILockable
object Lock [get]
 

Private Member Functions

 NamedPipeClientBase ()
 

Private Attributes

string _pipeName = DefaultPipeName
 
string _serverAddress = DefaultServerAddress
 
NamedPipeClientStream _clientPipe = null
 
bool _test = true
 
StreamReader _inputStream = null
 
StreamWriter _outputStream = null
 

Static Private Attributes

static string _defaultServerAddress = "."
 

Additional Inherited Members

- Public Attributes inherited from IG.Lib.IpcStreamClientServerBase
const int MinimalMessagePreffixLength = 3
 
- Protected Attributes inherited from IG.Lib.IpcStreamClientServerBase
object _lock = new object()
 

Detailed Description

Client to the pipe server (classes derived from IpcStreamClientServerBase2).

$A Igor xx Mar14;

Constructor & Destructor Documentation

IG.Lib.NamedPipeClientBase.NamedPipeClientBase ( )
inlineprivate
IG.Lib.NamedPipeClientBase.NamedPipeClientBase ( string  pipeName)
inline

Constructs a new named pipe client with the specified pipe name, default server address (DefaultServerAddress) and default values for other paramters.

Parameters
pipeNameName of the pipe. Must not be null or empty string.
IG.Lib.NamedPipeClientBase.NamedPipeClientBase ( string  pipeName,
string  serverAddress 
)
inline

Constructs a new named pipe client with the specified pipe name, server address (DefaultServerAddress) and default values for other paramters.

Parameters
pipeNameName of the pipe. Must not be null or empty string.
serverAddressAddress of the server where named pipe server is run. If null or empty string then the default server address is uesd (DefaultServerAddress), referring to the current computer.
IG.Lib.NamedPipeClientBase.NamedPipeClientBase ( string  pipeName,
string  serverAddress,
string  requestEnd,
string  responseEnd,
string  errorBegin 
)
inline

Constructs a new named pipe client with the specified pipe name, server address (DefaultServerAddress) and other paramters.

Parameters
pipeNameName of the pipe.
serverAddressAddress of the server where named pipe server is run. If null or empty string then the default server address is uesd (DefaultServerAddress), referring to the current computer.
requestEndLine that ends each request. If null or empty string then the requests are single line.
responseEndLine that ends each response. If null or empty string then the responses are single line.
errorBeginString that begins an error response. If null or empty string then default string remains in use, i.e. IpcStreamClientServerBase2.DefaultErrorBegin

Member Function Documentation

override void IG.Lib.NamedPipeClientBase.ClosePipe ( )
inlinevirtual

Closes the Server's pipe and the associated streams.

Implements IG.Lib.IpcStreamClientServerBase2.

override void IG.Lib.NamedPipeClientBase.CloseConnection ( )
inlineprotectedvirtual

Closes the server pipe.

Implements IG.Lib.IpcStreamClientServerBase2.

override bool IG.Lib.NamedPipeClientBase.IsConnected ( )
inlinevirtual

Returns true if server pipe is connected, .

Implements IG.Lib.IpcStreamClientServerBase2.

override void IG.Lib.NamedPipeClientBase.Connect ( double  timeOutSeconds = 0)
inlinevirtual

Connects with the server.

If timeout is not specifies then it tries to connect indefinitely.

Parameters
timeOutSecondsTimeout in secconds for establishig connection.

Implements IG.Lib.IpcStreamClientBase.

Referenced by IG.Lib.CommandLineApplicationInterpreter.CreatePipeClient().

virtual void IG.Lib.NamedPipeClientBase.Connect ( NamedPipeClientStream  pipe,
double  timeOutSeconds = 0 
)
inlineprotectedvirtual

Connects the specified pype with the server.

If timeout is not specifies then it tries to connect indefinitely.

Parameters
pipePipe through which connection with the serverr is achieved.
timeOutSecondsTimeout in secconds for establishig connection.
override string IG.Lib.NamedPipeClientBase.ToString ( )
inline

Returns a stirng containing the server data.

Member Data Documentation

string IG.Lib.NamedPipeClientBase._pipeName = DefaultPipeName
private
string IG.Lib.NamedPipeClientBase._defaultServerAddress = "."
staticprivate
string IG.Lib.NamedPipeClientBase._serverAddress = DefaultServerAddress
private
NamedPipeClientStream IG.Lib.NamedPipeClientBase._clientPipe = null
private
bool IG.Lib.NamedPipeClientBase._test = true
private
StreamReader IG.Lib.NamedPipeClientBase._inputStream = null
private
StreamWriter IG.Lib.NamedPipeClientBase._outputStream = null
private

Property Documentation

override string IG.Lib.NamedPipeClientBase.Name
getset

Client name. The same as pipe name.

string IG.Lib.NamedPipeClientBase.PipeName
getset
string IG.Lib.NamedPipeClientBase.DefaultServerAddress
staticgetset

Default server address. Setting to null sets it to "." (i.e. the local machine).

string IG.Lib.NamedPipeClientBase.ServerAddress
getset

Server address.

Setting it to null sets it to DefaultServerAddress.

NamedPipeClientStream IG.Lib.NamedPipeClientBase.ClientPipe
getprotected set

Named pipe used for communication by the server.

override StreamReader IG.Lib.NamedPipeClientBase.InputStream
getprotected set

Input stream of the server's named pipe.

override StreamWriter IG.Lib.NamedPipeClientBase.OutputStream
getprotected set

Output stream of the server's named pipe.


The documentation for this class was generated from the following file: