C# Class NetMQ.Core.SessionBase

Inheritance: NetMQ.Core.Own, Pipe.IPipeEvents, IProactorEvents, IMsgSink, IMsgSource
Show file Open project: NetMQ/NetMQ3-x Class Usage Examples

Private Properties

Property Type Description
CleanPipes void
Create SessionBase
Detached void
ProceedWithTerm void
StartConnecting void

Public Methods

Method Description
AttachPipe ( [ pipe ) : void

Attach the given pipe to this session.

This is to be used once only, when creating the session.

Destroy ( ) : void

Terminate and release any contained resources. This cancels the linger-timer if that exists, and terminates the protocol-engine if that exists.

Detach ( ) : void

Flush out any leftover messages and call Detached.

Flush ( ) : void

Flush any messages that are in the pipe downstream.

Hiccuped ( NetMQ.Core.Pipe pipe ) : void
InCompleted ( SocketError socketError, int bytesTransferred ) : void

This method would be called when a message receive operation has been completed, although here it only throws a NotSupportedException.

OutCompleted ( SocketError socketError, int bytesTransferred ) : void

This method would be called when a message Send operation has been completed, although here it only throws a NotSupportedException.

PullMsg ( Msg &msg ) : bool

Read a message from the pipe.

PushMsg ( Msg &msg ) : bool

Write the given Msg to the pipe.

ReadActivated ( NetMQ.Core.Pipe pipe ) : void

Indicate that the given pipe is now ready for reading. Pipe calls this on it's sink in response to ProcessActivateRead.

SessionBase ( [ ioThread, bool connect, [ socket, [ options, [ addr ) : System

Create a new SessionBase object from the given IOThread, socket, and Address.

Terminated ( NetMQ.Core.Pipe pipe ) : void

This gets called by ProcessPipeTermAck or XTerminated to respond to the termination of the given pipe.

TimerEvent ( int id ) : void

This is called when the timer expires.

ToString ( ) : string

Override the ToString method to also show the socket-id.

WriteActivated ( NetMQ.Core.Pipe pipe ) : void

Protected Methods

Method Description
ProcessAttach ( IEngine engine ) : void

Process the Attach-request by hooking up the pipes and plugging in the given engine.

ProcessPlug ( ) : void

Process the Plug-request by setting this SessionBase as teh handler for the io-object and starting connecting (without waiting).

ProcessTerm ( int linger ) : void

Process a termination request.

Reset ( ) : void

Set the identity-sent and identity-received flags to false.

Private Methods

Method Description
CleanPipes ( ) : void

Remove any half processed messages. Flush unflushed messages. Call this function when engine disconnect to get rid of leftovers.

Create ( [ ioThread, bool connect, [ socket, [ options, [ addr ) : SessionBase
Detached ( ) : void

The parent SessionBase class calls this when the Detach method finishes detaching.

ProceedWithTerm ( ) : void

Call this function to move on with the delayed process-termination request.

StartConnecting ( bool wait ) : void

Begin connecting.

Method Details

AttachPipe() public method

Attach the given pipe to this session.
This is to be used once only, when creating the session.
public AttachPipe ( [ pipe ) : void
pipe [
return void

Destroy() public method

Terminate and release any contained resources. This cancels the linger-timer if that exists, and terminates the protocol-engine if that exists.
public Destroy ( ) : void
return void

Detach() public method

Flush out any leftover messages and call Detached.
public Detach ( ) : void
return void

Flush() public method

Flush any messages that are in the pipe downstream.
public Flush ( ) : void
return void

Hiccuped() public method

public Hiccuped ( NetMQ.Core.Pipe pipe ) : void
pipe NetMQ.Core.Pipe
return void

InCompleted() public method

This method would be called when a message receive operation has been completed, although here it only throws a NotSupportedException.
This operation is not supported on the SessionBase class.
public InCompleted ( SocketError socketError, int bytesTransferred ) : void
socketError SocketError a SocketError value that indicates whether Success or an error occurred
bytesTransferred int the number of bytes that were transferred
return void

OutCompleted() public method

This method would be called when a message Send operation has been completed, although here it only throws a NotSupportedException.
This operation is not supported on the SessionBase class.
public OutCompleted ( SocketError socketError, int bytesTransferred ) : void
socketError SocketError a SocketError value that indicates whether Success or an error occurred
bytesTransferred int the number of bytes that were transferred
return void

ProcessAttach() protected method

Process the Attach-request by hooking up the pipes and plugging in the given engine.
protected ProcessAttach ( IEngine engine ) : void
engine IEngine the IEngine to plug in
return void

ProcessPlug() protected method

Process the Plug-request by setting this SessionBase as teh handler for the io-object and starting connecting (without waiting).
protected ProcessPlug ( ) : void
return void

ProcessTerm() protected method

Process a termination request.
protected ProcessTerm ( int linger ) : void
linger int a time (in milliseconds) for this to linger before actually going away. -1 means infinite.
return void

PullMsg() public method

Read a message from the pipe.
public PullMsg ( Msg &msg ) : bool
msg Msg a reference to a Msg to put the message into
return bool

PushMsg() public method

Write the given Msg to the pipe.
public PushMsg ( Msg &msg ) : bool
msg Msg the Msg to push to the pipe
return bool

ReadActivated() public method

Indicate that the given pipe is now ready for reading. Pipe calls this on it's sink in response to ProcessActivateRead.
public ReadActivated ( NetMQ.Core.Pipe pipe ) : void
pipe NetMQ.Core.Pipe the pipe to indicate is ready for reading
return void

Reset() protected method

Set the identity-sent and identity-received flags to false.
protected Reset ( ) : void
return void

SessionBase() public method

Create a new SessionBase object from the given IOThread, socket, and Address.
public SessionBase ( [ ioThread, bool connect, [ socket, [ options, [ addr ) : System
ioThread [ the IOThread for this session to run on
connect bool this flag dictates whether to connect
socket [ the socket to contain
options [ Options that dictate the settings of this session
addr [ an Address that dictates the protocol and IP-address to use when connecting
return System

Terminated() public method

This gets called by ProcessPipeTermAck or XTerminated to respond to the termination of the given pipe.
public Terminated ( NetMQ.Core.Pipe pipe ) : void
pipe NetMQ.Core.Pipe the pipe that was terminated
return void

TimerEvent() public method

This is called when the timer expires.
public TimerEvent ( int id ) : void
id int an integer used to identify the timer
return void

ToString() public method

Override the ToString method to also show the socket-id.
public ToString ( ) : string
return string

WriteActivated() public method

public WriteActivated ( NetMQ.Core.Pipe pipe ) : void
pipe NetMQ.Core.Pipe
return void