Prajna


GenericConn

A generic connection which processes SocketAsyncEventArgs

Constructors

ConstructorDescription
new()
Signature: unit -> GenericConn

Instance members

Instance memberDescription
AfterSendCallback()
Signature: unit -> SocketAsyncEventArgs -> unit

Function to call when Send finishes

AfterSendCallback()
Signature: unit -> unit

Function to call when Send finishes

CompRecv
Signature: Component<RBufPart<byte>>

The internal Component used for receiving SocketAsyncEventArgs

CompSend
Signature: Component<RBufPart<byte>>

The internal Component used for sending SocketAsyncEventArgs

ConnKey
Signature: string

A connection key to identify the connection

CurBufRecv()
Signature: unit -> byte []

this specifies the current buffer being used to process and copy data from a received SocketAsyncEventArgs

CurBufRecv()
Signature: unit -> unit

this specifies the current buffer being used to process and copy data from a received SocketAsyncEventArgs

CurBufRecvMs()
Signature: unit -> StreamBase<byte>

If RecvDequeueGenericConn/x.ProcessRecvGenericConn are being used for component processing this specifies the memorystream

CurBufRecvMs()
Signature: unit -> unit

If RecvDequeueGenericConn/x.ProcessRecvGenericConn are being used for component processing this specifies the memorystream

CurBufRecvOffset()
Signature: unit -> int

If RecvDequeueGenericConn/x.ProcessRecvGenericConn are being used for component processing this specifies the offset within the buffer being to process and copy data from a received SocketAsyncEventArgs

CurBufRecvOffset()
Signature: unit -> unit

If RecvDequeueGenericConn/x.ProcessRecvGenericConn are being used for component processing this specifies the offset within the buffer being to process and copy data from a received SocketAsyncEventArgs

CurBufRecvRem()
Signature: unit -> int

If RecvDequeueGenericConn/x.ProcessRecvGenericConn are being used for component processing this specifies the remaining size of the buffer being used to process and copy data from a received SocketAsyncEventArgs

CurBufRecvRem()
Signature: unit -> unit

If RecvDequeueGenericConn/x.ProcessRecvGenericConn are being used for component processing this specifies the remaining size of the buffer being used to process and copy data from a received SocketAsyncEventArgs

CurBufSend()
Signature: unit -> byte []

If ProcessSendGenericConn is being used used for sender component processing this specifies the current buffer being processed and copied to a SocketAsyncEventArgs

CurBufSend()
Signature: unit -> unit

If ProcessSendGenericConn is being used used for sender component processing this specifies the current buffer being processed and copied to a SocketAsyncEventArgs

CurBufSendOffset()
Signature: unit -> int

If ProcessSendGenericConn is being used used for sender component processing this specifies the offset in the current buffer being processed and copied to a SocketAsyncEventArgs

CurBufSendOffset()
Signature: unit -> unit

If ProcessSendGenericConn is being used used for sender component processing this specifies the offset in the current buffer being processed and copied to a SocketAsyncEventArgs

CurBufSendRem()
Signature: unit -> int

If ProcessSendGenericConn is being used used for sender component processing this specifies the remainder of the current buffer being processed and copied to a SocketAsyncEventArgs

CurBufSendRem()
Signature: unit -> unit

If ProcessSendGenericConn is being used used for sender component processing this specifies the remainder of the current buffer being processed and copied to a SocketAsyncEventArgs

ESendSA
Signature: RBufPart<byte>
LastRecvTicks()
Signature: unit -> DateTime
LastRecvTicks()
Signature: unit -> unit
LastSendTicks()
Signature: unit -> DateTime
LastSendTicks()
Signature: unit -> unit
MaxTokenSize()
Signature: unit -> int64

Set maximum number of tokens for connection

MaxTokenSize()
Signature: unit -> unit

Set maximum number of tokens for connection

OnSocketClose()
Signature: unit -> Option<(IConn -> obj -> unit)>

Optional argument - function to call upon socket closing

OnSocketClose()
Signature: unit -> unit

Optional argument - function to call upon socket closing

OnSocketCloseState()
Signature: unit -> obj

State to be passed in when OnSocketClose is called

OnSocketCloseState()
Signature: unit -> unit

State to be passed in when OnSocketClose is called

ProcessRecvGenericConn(...)
Signature: (furtherProcess:(unit -> ManualResetEvent)) -> rb:RBufPart<byte> -> bool * ManualResetEvent

Generic function for SocketAsyncEvent processing to be used by users of GenericConn class A function to execute when CurBufRecvRem reaches zero The function should return a ManualResetEvent - if it is non-null, processing cannot continue and receiving Component waits In this implementation, thread pool is used for the receiver Component processing
The SocketAsyncEventArg being currently processed - not set by caller An example of usage is the following: x.CompRecv.Proc <- x.ProcessRecvGenericConn ProcessRecvCommand where "x" is an instance of GenericConn class and ProcessRecvCommand is function to perform further processing once x.CurBufRecvRem reaches zero

ProcessRecvGenericConnMs(...)
Signature: (furtherProcess:(unit -> ManualResetEvent)) -> rb:RBufPart<byte> -> bool * ManualResetEvent

Generic function for SocketAsyncEvent processing to be used by users of GenericConn class A function to execute when CurBufRecvRem reaches zero The function should return a ManualResetEvent - if it is non-null, processing cannot continue and receiving Component waits In this implementation, thread pool is used for the receiver Component processing
The SocketAsyncEventArg being currently processed - not set by caller An example of usage is the following: x.CompRecv.Proc <- x.ProcessRecvGenericConn ProcessRecvCommand where "x" is an instance of GenericConn class and ProcessRecvCommand is function to perform further processing once x.CurBufRecvRem reaches zero

ProcessSendGenericConn(...)
Signature: (enqueueAction:(RBufPart<byte> -> bool * ManualResetEvent)) -> (furtherProcess:(unit -> bool * bool)) -> bool * ManualResetEvent

A generic processor for copying buffers into SocketAsyncEventArgs for sending on network The action to enqueue the SocketAsyncEventArgs once it is assembled The function to call once CurBufSendRem reaches zero. This function should return (bDone, bForceEnqueue) as (bool, bool) - bDone represents whether we are done proecssing the item to be sent - bForceEnqueue represents whether we should force the current SocketAsyncEventArgs on the queue or whether we should try to coalesce more data from the next item onto the same SocketAsyncEventArgs

RecvDequeueGenericConn(dequeueAction e)
Signature: (dequeueAction:(RBufPart<byte> ref -> bool * ManualResetEvent)) -> (e:RBufPart<byte> ref) -> bool * ManualResetEvent

Generic function for recv dequeue to be used by users of GenericConn class The action used to dequeue a SocketAsyncEventArgs to process The SocketAsyncEventArg being processed This function should be used by using following as example to set the component processors: x.CompRecv.Dequeue <- x.RecvDequeueGenericConn x.CompRecv.Dequeue where "x" is an instance of the GenericConn class - that is only dequeueAction should be specified

RecvQEnqueue()
Signature: unit -> RBufPart<byte> -> bool * ManualResetEvent

The function to call to enqueue received SocketAsyncEventArgs

RecvQEnqueue()
Signature: unit -> unit

The function to call to enqueue received SocketAsyncEventArgs

RecvRelease(rb)
Signature: (rb:RBufPart<byte> ref) -> unit

Release SA being processed on receiver side The element to be released

SendSpeed()
Signature: unit -> int64

Set maximum sending speed for connection in bits per second

SendSpeed()
Signature: unit -> unit

Set maximum sending speed for connection in bits per second

SetTokenUse(...)
Signature: (initTokens:int64 * maxTokens:int64 * mss:int * initSendSpeed:int64) -> unit

Set token usage - Optional if you wish to implement control of sending rate The initial number of tokens The maximum number of tokens The sending speed in bits per second

Fork me on GitHub