| IGLib 1.5 The IGLib base library for development of numerical, technical and business applications.

- Main Page
- Namespaces
- Classes
- Files

- Class List
- Class Index
- Class Hierarchy
- Class Members

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Events
Public Member Functions | Protected Member Functions | Properties | Private Member Functions | Private Attributes | List of all members
IG.Lib.Copy.NamedPipeServerBase Class Reference

Server that creates a named pipe, listens on its input stream, and sends responses to the client. More...

Inheritance diagram for IG.Lib.Copy.NamedPipeServerBase:
[legend]
Collaboration diagram for IG.Lib.Copy.NamedPipeServerBase:
[legend]

## Public Member Functions
| NamedPipeServerBase (string pipeName, bool startImmediately=true)
| Constructs a new pip server. More...
| NamedPipeServerBase (string pipeName, string requestEnd, string responseEnd, string errorBegin, bool startImmediately=true)
| Constructs a new named pipe server with the specified pipe name and other paramters. More...
override bool | IsServerPipelineConnected ()
| Returns true if server pipe is connected, . More...
override void | ClosePipe ()
| Closes the Server's pipe and the associated streams. More...
override void | SendDummyRequest ()
| Sends a dummy request in order for the serving function to stop blocking More...
override string | ToString ()
| Returns a stirng containing the server data. More...
Public Member Functions inherited from IG.Lib.Copy.ServerStreamBase
override void | CloseInput ()
| Closes the inpt stream. More...
override void | CloseOutput ()
| Closes the outut stream. More...
virtual void | StopServer ()
virtual string | GetResponse (string request)
| Returns response string for given request string. More...
void | ThreadServe ()
| Launches a named pipe server in a new thread. More...
void | AbortWorkingThread (double timeoutSeconds=0)
| Aborts the working thread. 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.Copy.ClientServerStreamBase2
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.Copy.ClienServerStreamBase
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 | SetMessageSeparator (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)
| Generates request and response string in such a way that it can not be mixed up with a message. More...
void | GetRequestOrResponse (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...

## Protected Member Functions
override void | NullifyServerPipeLine ()
| Closes the server pipe. More...
override void | WaitForConnection ()
| Waits until a client connects to the specified server pipe. More...
virtual void | WaitForConnection (NamedPipeServerStream pipe)
| Waits until a client connects to the specified server pipe. More...
Protected Member Functions inherited from IG.Lib.Copy.ServerStreamBase
virtual string | GetErrorMessage (Exception ex)
| Returns error message corresponding to the specified exception. More...
virtual string | ReadRequest ()
| Reads the next request from the pipe. More...
virtual void | SendResponse (string responseString)
| Sends the specified response string back to the server. More...
virtual void | SendResponse ()
| Sends the response (i.e., the ResponseString) back to the client. More...
virtual void | RespondToRequest ()
| Reads a single request from the client and sends back the response. More...
virtual void | ServeInCurrentThread ()
| Enters the serving loop. More...

## Properties
override string | Name`[get, set]`
| Server name. The same as pipe name. More...
string | PipeName`[get, set]`
NamedPipeServerStream | ServerPipe`[get, protected set]`
| Named pipe used for communication by the server. More...
override StreamReader | InputStream`[get, protected set]`
| Input stream of the server. More...
override StreamWriter | OutputStream`[get, protected set]`
| Output stream of the server's named pipe. More...
Properties inherited from IG.Lib.Copy.ServerStreamBase
bool | IsResponseSent`[get, protected set]`
| Auxiliary flag telling whether response to a request has already been sent to the client. Used for synchronization of diffeeent parts of the response generation process, which enables e.g special handling of Exceptions. More...
bool | StopServe`[get, protected set]`
| Whether the pipe should be closed. More...
bool | IsServerRunning`[get, protected set]`
| Flag telling whether the server is currently running. More...
virtual ResponseDelegate | ResponseMethod`[get, set]`
| Delegate that calculates response to given request. More...
ThreadPriority | ThreadPriority`[get, set]`
| Priority of the server thread. More...
Properties inherited from IG.Lib.Copy.ClientServerStreamBase2
abstract string | Name`[get, set]`
static string | DefaultPipeName`[get, set]`
| Default pipe name. More...
static bool | DefaultIsMultilineRequest`[get]`
| Default pipe name. More...
static string | DefaultRequestEnd`[get]`
| Default string (line) that ends any multiline request. More...
static bool | DefaultIsMultilineResponse`[get]`
| Default pipe name. More...
static string | DefaultResponseEnd`[get]`
| Default string (line) that ends any multiline response. More...
virtual bool | IsMultilineRequest`[get, protected set]`
| Whether or not multi line requests are allowed. More...
string | RequestEnd`[get, protected set]`
virtual bool | IsMultilineResponse`[get, protected set]`
| Whether or not multi line responses are allowed. More...
string | ResponseEnd`[get, protected set]`
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...
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...
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.Copy.ClienServerStreamBase
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...
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...
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...
Properties inherited from IG.Lib.ILockable
object | Lock`[get]`

## Private Member Functions
| NamedPipeServerBase ()
| Prevent default constructor. More...

## Private Attributes
string | _pipeName = DefaultPipeName
NamedPipeServerStream | _serverPipe =null
StreamReader | _inputStream = null
StreamWriter | _outputStream = null

## Additional Inherited Members
Public Attributes inherited from IG.Lib.Copy.ClienServerStreamBase
const int | MinimalMessagePreffixLength = 3
Static Protected Member Functions inherited from IG.Lib.Copy.ServerStreamBase
static string | DefaultResponseMethod (string request)
| The deefault method that returns response to the specified request. More...
Protected Attributes inherited from IG.Lib.Copy.ServerStreamBase
ThreadPriority | _threadPriority = UtilSystem.ThreadPriority
Protected Attributes inherited from IG.Lib.Copy.ClienServerStreamBase
object | _lock = new object()

## Detailed Description

Server that creates a named pipe, listens on its input stream, and sends responses to the client.

$A Igor xx Mar14;

## Constructor & Destructor Documentation

IG.Lib.Copy.NamedPipeServerBase.NamedPipeServerBase | ( |  | ) |
| inline private

Prevent default constructor.

IG.Lib.Copy.NamedPipeServerBase.NamedPipeServerBase | ( | string | pipeName,
|  | bool | startImmediately = `true`
| ) |  |
| inline

Constructs a new pip server.

Parameters

  pipeName | Name of the pipe used for client-server communication.
  startImmediately | If true then server is started immediately after created.

IG.Lib.Copy.NamedPipeServerBase.NamedPipeServerBase | ( | string | pipeName,
|  | string | requestEnd,
|  | string | responseEnd,
|  | string | errorBegin,
|  | bool | startImmediately = `true`
| ) |  |
| inline

Constructs a new named pipe server with the specified pipe name and other paramters.

Parameters

  pipeName | Name of the pipe.
  requestEnd | Line that ends each request. If null or empty string then the requests are single line.
  responseEnd | Line that ends each response. If null or empty string then the responses are single line.
  errorBegin | String that begins an error response. If null or empty string then default string remains in use, i.e. DefaultErrorBegin
  startImmediately | If true then server is started immediately after created.

## Member Function Documentation

override void IG.Lib.Copy.NamedPipeServerBase.NullifyServerPipeLine | ( |  | ) |
| inline protected virtual

Closes the server pipe.

Implements IG.Lib.Copy.ServerStreamBase.

override bool IG.Lib.Copy.NamedPipeServerBase.IsServerPipelineConnected | ( |  | ) |
| inline virtual

Returns true if server pipe is connected, .

Implements IG.Lib.Copy.ServerStreamBase.

override void IG.Lib.Copy.NamedPipeServerBase.WaitForConnection | ( |  | ) |
| inline protected virtual

Waits until a client connects to the specified server pipe.

Parameters

  pipe | Pipe that waits for connection to be established.

Implements IG.Lib.Copy.ServerStreamBase.

virtual void IG.Lib.Copy.NamedPipeServerBase.WaitForConnection | ( | NamedPipeServerStream | pipe | ) |
| inline protected virtual

Waits until a client connects to the specified server pipe.

Parameters

  pipe | Pipe that waits for connection to be established.

override void IG.Lib.Copy.NamedPipeServerBase.ClosePipe | ( |  | ) |
| inline virtual

Closes the Server's pipe and the associated streams.

Implements IG.Lib.Copy.ClientServerStreamBase2.

override void IG.Lib.Copy.NamedPipeServerBase.SendDummyRequest | ( |  | ) |
| inline virtual

Sends a dummy request in order for the serving function to stop blocking

Implements IG.Lib.Copy.ServerStreamBase.

override string IG.Lib.Copy.NamedPipeServerBase.ToString | ( |  | ) |
| inline

Returns a stirng containing the server data.

## Member Data Documentation

string IG.Lib.Copy.NamedPipeServerBase._pipeName = DefaultPipeName
| private

NamedPipeServerStream IG.Lib.Copy.NamedPipeServerBase._serverPipe =null
| private

StreamReader IG.Lib.Copy.NamedPipeServerBase._inputStream = null
| private

StreamWriter IG.Lib.Copy.NamedPipeServerBase._outputStream = null
| private

## Property Documentation

override string IG.Lib.Copy.NamedPipeServerBase.Name
| get set

Server name. The same as pipe name.

string IG.Lib.Copy.NamedPipeServerBase.PipeName
| get set

NamedPipeServerStream IG.Lib.Copy.NamedPipeServerBase.ServerPipe
| get protected set

Named pipe used for communication by the server.

override StreamReader IG.Lib.Copy.NamedPipeServerBase.InputStream
| get protected set

Input stream of the server.

override StreamWriter IG.Lib.Copy.NamedPipeServerBase.OutputStream
| get protected set

Output stream of the server's named pipe.

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

- igbase/data/streams/streams_copy/NamedPipes_Copy.cs