Prajna


NetworkCommandQueue

An extension to GenericConn to process NetworkCommand GenericConn is an internal object which contains Send/Recv Components to process SocketAsyncEventArgs objects NetworkCommandQueue contains Send/Recv Components to process NetworkCommand objects The general pipeline looks like following For Recv: Network -> GenericConn (ProcessRecvGenericConn) -> NetworkCommandQueue (function from AddRecvProc) -> Application RecvAsync->queue CompRecv of GenericConn CompRecv of NetworkCommandQueue SocketAsyncEventArgs->NetworkCommand NetworkCommand->application To Queue of NetworkCommandQueue For Send: Network <- (SendAsync) GenericConn <- (ProcessSendGenericConn) NetworkCommandQueue <- Application CompSend of GenericConn CompSend of NetworkCommandQueue network<-SocketAsyncEventArgs SocketAsyncEventArgs<-NetworkCommand Application writes to NetworkCommand queue using ToSend

Constructors

ConstructorDescription
new(addr, port, onet)
Signature: (addr:IPAddress * port:int * onet:NetworkConnections) -> NetworkCommandQueue
  1. Constructor when connecting to machine with address/port (w/o DNS resolve)
new(machineName, port, onet)
Signature: (machineName:string * port:int * onet:NetworkConnections) -> NetworkCommandQueue
  1. Constructor when connecting to machine with name/port (with DNS resolve)
new(soc, onet)
Signature: (soc:Socket * onet:NetworkConnections) -> NetworkCommandQueue
  1. Constructor used when accepting a new connection
new()
Signature: unit -> NetworkCommandQueue

Instance members

Instance memberDescription
AddLoopbackProps(...)
Signature: (requireAuth:bool * myguid:Guid * rsaParam:(byte [] * byte []) * pwd:string) -> unit
AddRecvProc(processItem)
Signature: (processItem:(NetworkCommand -> ManualResetEvent)) -> string

Add receiver processing - multiple processeros may be added The function to process NetworkCommand objects from queue

BeginConnect(addr, port)
Signature: (addr:IPAddress * port:int) -> unit

Begin connection to IP address The IPAddress to connect to The port to connect to

CanSend
Signature: bool

Tells if we are we allowed to send

Close()
Signature: unit -> unit
Modifiers: abstract

Normal close of socket/queue,

Conn
Signature: GenericConn
ConnectionStatus
Signature: ConnectionStatus

Connection Status

DisposeResource()
Signature: unit -> unit
EndConnect(ar, soc, addr, port)
Signature: (ar:IAsyncResult * soc:Socket * addr:IPAddress * port:int) -> unit
EPInfo
Signature: string
flowcontrol_lastack
Signature: DateTime ref
flowcontrol_lastRcvdCommandSerial
Signature: int64 ref
flowcontrol_lock
Signature: int ref
GetOrAddRecvProc(name, processItem)
Signature: (name:string * processItem:(NetworkCommand -> ManualResetEvent)) -> unit

Add receiver processing - multiple processeros may be added The function to process NetworkCommand objects from queue

GetPendingCommandEventIfNeeded()
Signature: unit -> ManualResetEvent

Get Event for pending command if there is one, else null The event to wait for, or null if a wait is not required.

HasFailed
Signature: bool

Tells if NetworkCommandQueue has failed

Initialize()
Signature: unit -> unit

Initialize the NetworkCommandQueue - Only call after AddRecvProc are all done

Initialized
Signature: bool

Tells if event initialized has been set

LastMonitorPendingCommand()
Signature: unit -> DateTime

Last time pending command was monitored

LastMonitorPendingCommand()
Signature: unit -> unit

Last time pending command was monitored

LastSendTicks()
Signature: unit -> DateTime
LastSendTicks()
Signature: unit -> unit
LocalEndPoint
Signature: EndPoint

The local endpoint of the connection

MarkFail()
Signature: unit -> unit

Mark the connection as having failed and terminate

MaxTokenSize()
Signature: unit -> int64

The maximum size of sending token bucket

MaxTokenSize()
Signature: unit -> unit

The maximum size of sending token bucket

MonitorRcvd()
Signature: unit -> unit

Monitor the connection

MyAuthRSA()
Signature: unit -> RSACryptoServiceProvider

A RSA Crypto service provider for authentication

MyAuthRSA()
Signature: unit -> unit

A RSA Crypto service provider for authentication

MyExchangeRSA()
Signature: unit -> RSACryptoServiceProvider

A RSA Cryto service provider for key exchange

MyExchangeRSA()
Signature: unit -> unit

A RSA Cryto service provider for key exchange

MyGuid()
Signature: unit -> Guid

GUID of this connection

MyGuid()
Signature: unit -> unit

GUID of this connection

PendingCommand()
Signature: unit -> Option<ControllerCommand * StreamBase<byte>> * DateTime

The pending command which has not yet been processed

PendingCommand()
Signature: unit -> unit

The pending command which has not yet been processed

RcvdCommandSerial
Signature: int64

The index of the last received command

RcvdSpeed
Signature: int64

Current speed limit on the receiving interface

ReceivingCommandQueueLength
Signature: int

Length of receiving queue of NetworkCommand

ReceivingQueueLength
Signature: int

Length of receiving queue of SocketAsyncEventArgs in internal GenericConn

RecvQueueSize
Signature: int64

Length of receiving queue of SocketAsyncEventArgs in units of bytes in internal GenericConn

RemoteEndPoint
Signature: EndPoint

The remote endpoint of the connection

RemoteEndPointSignature
Signature: int64

Int64 value of the RemoteEndPoint

RequireAuth()
Signature: unit -> bool

Whether authentication is required or not - if authentication required other side has AES key for sending encrypted messages here

RequireAuth()
Signature: unit -> unit

Whether authentication is required or not - if authentication required other side has AES key for sending encrypted messages here

SendCommandQueueLength
Signature: int

Length of sending queue of NetworkCommand

SendQueueLength
Signature: int

Length of sending queue of SocketAsyncEventArgs in internal GenericConn

SendQueueSize
Signature: int64

Length of sending queue of NetworkCommand in units of bytes

SendSpeed
Signature: int64

Current sending limit

SetRcvdSpeed(rcvdSpeedNew)
Signature: rcvdSpeedNew:int64 -> unit

Set the receiving speed for this connection

SetSendSpeed(sendSpeedNew)
Signature: sendSpeedNew:int64 -> unit

Set the sending speed for this connection

Shutdown
Signature: bool

Tells if connection is capable of receiving more data

StatusInfo()
Signature: unit -> string
Stopwatch
Signature: Stopwatch

A stopwatch which starts when connection established

Terminate()
Signature: unit -> unit

Terminate network queue, all pending actions are discarded.

ToForward(...)
Signature: (endPoints:IPEndPoint [] * command:ControllerCommand * sendStream:StreamBase<byte> * bExpediateSend:bool option) -> unit

Wrap the Memstream to forward to multiple endPoints during the communication. The endpoints to forward to The controller command The associated MemStream to send Optional argument - unused for now

ToForward(...)
Signature: (endPoint:IPEndPoint * command:ControllerCommand * sendStream:StreamBase<byte> * bExpediateSend:bool option) -> unit

Wrap the Memstream to forward to 1 endPoint during the communication. The endpoint to forward to The controller command The associated MemStream to send Optional argument - unused for now

ToSend(...)
Signature: (command:ControllerCommand * sendStream:StreamBase<byte> * bExpediateSend:'?11567 option) -> unit
Type parameters: '?11567

Add command to sender queue - enqueue takes place synchronously, blocks caller The ControllerCommand to send The associated MemStream to send Optional - Unused parameter

ToSendEncrypt(...)
Signature: (command:ControllerCommand * arr:byte [] * offset:int * arrCount:int) -> unit

Add command to sender queue using encryption - decryption takes place automatically enqueue takes place synchronously, blocks caller The ControllerCommand to send The associated buffer to send The offset into the buffer to send The length of content in buffer to send (starting at offset)

ToSendFromPos(...)
Signature: (command:ControllerCommand * sendStream:StreamBase<byte> * startPos:int64 * bExpediateSend:'?11571 option) -> unit
Type parameters: '?11571

Add command to sender queue - enqueue takes place synchronously, blocks caller The ControllerCommand to send The associated MemStream to send Start sending from this position Optional - Unused parameter

ToSendNonBlock(...)
Signature: (command:ControllerCommand * sendStream:StreamBase<byte> * bExpediateSend:'?11569 option) -> unit
Type parameters: '?11569
TotalBytesRcvd
Signature: int64

The total bytes recieved by connection

TotalBytesSent
Signature: int64

The total bytes sent by connection

UnProcessedCmdInBytes
Signature: int64

A count of unprocessed bytes (those which have not been acknowledged)

UnProcessedCmdInMB
Signature: int

UnProcessedCmdInBytes in units of MB

Static members

Static memberDescription
LoopbackConnect(...)
Signature: (port:int * onet:NetworkConnections * requireAuth:bool * myguid:Guid * rsaParam:(byte [] * byte []) * pwd:string) -> NetworkCommandQueue
MaxTryConnectCount
Signature: int
QueueFail(x)
Signature: x:NetworkCommandQueue -> bool

Tells if queue is null or has failed

Fork me on GitHub