Connection

Overview

The Stream based Connection class is the basis for all communications between clients and servers. Clients can obtain a Connection object by calling one of the Connect methods of the Client component; Servers will obtain Connection objects for every incoming connection that gets established.

Connection provides a variety of functions to enable sending and receiving of data with minimal code. Connection also provides protected methods that can be overridden in descendant classes to extend the Connection - for example to implement SSL encryption, compression or other protocol specifc or user-defined handing.

Location


 

constructor (Binding)

 

constructor(binding: Binding)

 

Connection(Binding binding)

 

Sub New(binding As Binding)

Parameters:

  • binding:

constructor (Socket)

 

constructor(socket: Socket)

 

Connection(Socket socket)

 

Sub New(socket As Socket)

Parameters:

  • socket:

AsyncDisconnect

 

event AsyncDisconnect: EventHandler;

 

delegate EventHandler AsyncDisconnect()

 

Event AsyncDisconnect As EventHandler

AsyncHaveIncompleteData

 

event AsyncHaveIncompleteData: EventHandler;

 

delegate EventHandler AsyncHaveIncompleteData()

 

Event AsyncHaveIncompleteData As EventHandler

Available

Returns the number of bytes available in the local receive buffer.

Override this method in descendant Connection classes if you need to perform additional handling or calculation on the size of available data.

 

property Available: Int32 read;

 

Int32 Available { get; }

 

ReadOnly Property Available() As Int32

BeginConnect (IPAddress, Int32, AsyncCallback, Object): IAsyncResult

 

method BeginConnect(address: IPAddress; port: Int32; callback: AsyncCallback; state: Object): IAsyncResult

 

IAsyncResult BeginConnect(IPAddress address, Int32 port, AsyncCallback callback, Object state)

 

Function BeginConnect(address As IPAddress, port As Int32, callback As AsyncCallback, state As Object) As IAsyncResult

Parameters:

  • address:
  • port:
  • callback:
  • state:

BeginConnect (EndPoint, AsyncCallback, Object): IAsyncResult

 

method BeginConnect(endPoint: EndPoint; callback: AsyncCallback; state: Object): IAsyncResult

 

IAsyncResult BeginConnect(EndPoint endPoint, AsyncCallback callback, Object state)

 

Function BeginConnect(endPoint As EndPoint, callback As AsyncCallback, state As Object) As IAsyncResult

Parameters:

  • endPoint:
  • callback:
  • state:

BeginInitializeServerConnection

 

method BeginInitializeServerConnection(callback: AsyncCallback; state: Object): IAsyncResult

 

IAsyncResult BeginInitializeServerConnection(AsyncCallback callback, Object state)

 

Function BeginInitializeServerConnection(callback As AsyncCallback, state As Object) As IAsyncResult

Parameters:

  • callback:
  • state:

BeginRead

 

method BeginRead(buffer: array of Byte; offset: Int32; count: Int32; callback: AsyncCallback; state: Object): IAsyncResult

 

IAsyncResult BeginRead(Byte[] buffer, Int32 offset, Int32 count, AsyncCallback callback, Object state)

 

Function BeginRead(buffer As Byte(), offset As Int32, count As Int32, callback As AsyncCallback, state As Object) As IAsyncResult

Parameters:

  • buffer:
  • offset:
  • count:
  • callback:
  • state:

BeginReadLine

 

method BeginReadLine(callback: AsyncCallback; state: Object): IAsyncResult

 

IAsyncResult BeginReadLine(AsyncCallback callback, Object state)

 

Function BeginReadLine(callback As AsyncCallback, state As Object) As IAsyncResult

Parameters:

  • callback:
  • state:

BeginWrite

 

method BeginWrite(buffer: array of Byte; offset: Int32; count: Int32; callback: AsyncCallback; state: Object): IAsyncResult

 

IAsyncResult BeginWrite(Byte[] buffer, Int32 offset, Int32 count, AsyncCallback callback, Object state)

 

Function BeginWrite(buffer As Byte(), offset As Int32, count As Int32, callback As AsyncCallback, state As Object) As IAsyncResult

Parameters:

  • buffer:
  • offset:
  • count:
  • callback:
  • state:

Binding

 

property Binding: Binding read;

 

Binding Binding { get; }

 

ReadOnly Property Binding() As Binding

BufferedAsync

 

property BufferedAsync: Boolean read write;

 

Boolean BufferedAsync { get; set; }

 

Property BufferedAsync() As Boolean

BufferReadLine

 

method BufferReadLine: String

 

String BufferReadLine()

 

Function BufferReadLine() As String

BytesReceived

 

property BytesReceived: Int64 read;

 

Int64 BytesReceived { get; }

 

ReadOnly Property BytesReceived() As Int64

BytesSent

 

property BytesSent: Int64 read;

 

Int64 BytesSent { get; }

 

ReadOnly Property BytesSent() As Int64

CanRead

 

property CanRead: Boolean read;

 

Boolean CanRead { get; }

 

ReadOnly Property CanRead() As Boolean

CanSeek

 

property CanSeek: Boolean read;

 

Boolean CanSeek { get; }

 

ReadOnly Property CanSeek() As Boolean

CanWrite

 

property CanWrite: Boolean read;

 

Boolean CanWrite { get; }

 

ReadOnly Property CanWrite() As Boolean

Close

Closes the data connection to the remote and terminates any calls to Receive that might still be blocking.

 

method Close

 

void Close()

 

Sub Close()

Connect (IPAddress, Int32)

 

method Connect(address: IPAddress; port: Int32)

 

void Connect(IPAddress address, Int32 port)

 

Sub Connect(address As IPAddress, port As Int32)

Parameters:

  • address:
  • port:

Connect (EndPoint)

Opens a connection to the target remote system.

 

method Connect(endPoint: EndPoint)

 

void Connect(EndPoint endPoint)

 

Sub Connect(endPoint As EndPoint)

Parameters:

  • endPoint:

Connected

The boolean Connected property can be evaluated at any given time to find out if the Connection object is referring to an open Connection. When a connection is first obtained, it will be open and the property will be true. Once the connection has been closed, whether purposely or by remote, the property will turn to false.

 

property Connected: Boolean read;

 

Boolean Connected { get; }

 

ReadOnly Property Connected() As Boolean

CRLF

 

var CRLF: array of Byte;

 

Byte[] CRLF

 

FIELD CRLF() As Byte()

DataSocket

 

property DataSocket: Socket read;

 

Socket DataSocket { get; }

 

ReadOnly Property DataSocket() As Socket

DataSocketAvailable

 

property DataSocketAvailable: Int32 read;

 

Int32 DataSocketAvailable { get; }

 

ReadOnly Property DataSocketAvailable() As Int32

DataSocketClose  protected

 

method DataSocketClose

 

void DataSocketClose()

 

Sub DataSocketClose()

DataSocketClose (Boolean)  protected

 

method DataSocketClose(dispose: Boolean)

 

void DataSocketClose(Boolean dispose)

 

Sub DataSocketClose(dispose As Boolean)

Parameters:

  • dispose:

DataSocketConnect  protected

 

method DataSocketConnect(endPoint: EndPoint)

 

void DataSocketConnect(EndPoint endPoint)

 

Sub DataSocketConnect(endPoint As EndPoint)

Parameters:

  • endPoint:

DataSocketConnected

Specified if the underlying DataSocket is connected.

Override this property in descendant Connection classes if you need additional logic to dertermine if a valid connection is avilable. For example, a secure connection might revert to a disconnected state if certain handshaking with the remote has failed, even though the physical socket is still actually connected.

 

property DataSocketConnected: Boolean read;

 

Boolean DataSocketConnected { get; }

 

ReadOnly Property DataSocketConnected() As Boolean

DataSocketReceiveWhatsAvailable  protected

 

method DataSocketReceiveWhatsAvailable(buffer: array of Byte; offset: Int32; size: Int32): Int32

 

Int32 DataSocketReceiveWhatsAvailable(Byte[] buffer, Int32 offset, Int32 size)

 

Function DataSocketReceiveWhatsAvailable(buffer As Byte(), offset As Int32, size As Int32) As Int32

Parameters:

  • buffer:
  • offset:
  • size:

DataSocketSend  protected

 

method DataSocketSend(buffer: array of Byte): Int32

 

Int32 DataSocketSend(Byte[] buffer)

 

Function DataSocketSend(buffer As Byte()) As Int32

Parameters:

  • buffer:

DataSocketSendAsMuchAsPossible  protected

 

method DataSocketSendAsMuchAsPossible(buffer: array of Byte; offset: Int32; size: Int32): Int32

 

Int32 DataSocketSendAsMuchAsPossible(Byte[] buffer, Int32 offset, Int32 size)

 

Function DataSocketSendAsMuchAsPossible(buffer As Byte(), offset As Int32, size As Int32) As Int32

Parameters:

  • buffer:
  • offset:
  • size:

DEFAULT_MAX_LINE_LENGTH

 

const DEFAULT_MAX_LINE_LENGTH: Int32 = 4096;

 

const Int32 DEFAULT_MAX_LINE_LENGTH = 4096

 

Dim DEFAULT_MAX_LINE_LENGTH As Int32 = 4096

DEFAULT_TIMEOUT

 

const DEFAULT_TIMEOUT: Int32 = 300;

 

const Int32 DEFAULT_TIMEOUT = 300

 

Dim DEFAULT_TIMEOUT As Int32 = 300

Disconnect

Closes the data connection to the remote and terminates any calls to Receive that might still be blocking.

 

method Disconnect

 

void Disconnect()

 

Sub Disconnect()

Dispose

 

method Dispose

 

void Dispose()

 

Sub Dispose()

EnableNagle

 

property EnableNagle: Boolean read write;

 

Boolean EnableNagle { get; set; }

 

Property EnableNagle() As Boolean

Encoding

 

property Encoding: Encoding read write;

 

Encoding Encoding { get; set; }

 

Property Encoding() As Encoding

EndConnect

 

method EndConnect(ar: IAsyncResult)

 

void EndConnect(IAsyncResult ar)

 

Sub EndConnect(ar As IAsyncResult)

Parameters:

  • ar:

EndInitializeServerConnection

 

method EndInitializeServerConnection(ar: IAsyncResult)

 

void EndInitializeServerConnection(IAsyncResult ar)

 

Sub EndInitializeServerConnection(ar As IAsyncResult)

Parameters:

  • ar:

EndRead

 

method EndRead(ar: IAsyncResult): Int32

 

Int32 EndRead(IAsyncResult ar)

 

Function EndRead(ar As IAsyncResult) As Int32

Parameters:

  • ar:

EndReadLine

 

method EndReadLine(ar: IAsyncResult): String

 

String EndReadLine(IAsyncResult ar)

 

Function EndReadLine(ar As IAsyncResult) As String

Parameters:

  • ar:

EndWrite

 

method EndWrite(ar: IAsyncResult)

 

void EndWrite(IAsyncResult ar)

 

Sub EndWrite(ar As IAsyncResult)

Parameters:

  • ar:

Flush

 

method Flush

 

void Flush()

 

Sub Flush()

Init

 

method Init(socket: Socket)

 

void Init(Socket socket)

 

Sub Init(socket As Socket)

Parameters:

  • socket:

InitializeServerConnection

 

method InitializeServerConnection

 

void InitializeServerConnection()

 

Sub InitializeServerConnection()

IntBeginRead  protected

 

method IntBeginRead(buffer: array of Byte; offset: Int32; count: Int32; callback: AsyncCallback; state: Object): IAsyncResult

 

IAsyncResult IntBeginRead(Byte[] buffer, Int32 offset, Int32 count, AsyncCallback callback, Object state)

 

Function IntBeginRead(buffer As Byte(), offset As Int32, count As Int32, callback As AsyncCallback, state As Object) As IAsyncResult

Parameters:

  • buffer:
  • offset:
  • count:
  • callback:
  • state:

IntBeginWrite  protected

 

method IntBeginWrite(buffer: array of Byte; offset: Int32; count: Int32; callback: AsyncCallback; state: Object): IAsyncResult

 

IAsyncResult IntBeginWrite(Byte[] buffer, Int32 offset, Int32 count, AsyncCallback callback, Object state)

 

Function IntBeginWrite(buffer As Byte(), offset As Int32, count As Int32, callback As AsyncCallback, state As Object) As IAsyncResult

Parameters:

  • buffer:
  • offset:
  • count:
  • callback:
  • state:

IntEndRead  protected

 

method IntEndRead(ar: IAsyncResult): Int32

 

Int32 IntEndRead(IAsyncResult ar)

 

Function IntEndRead(ar As IAsyncResult) As Int32

Parameters:

  • ar:

IntEndWrite  protected

 

method IntEndWrite(ar: IAsyncResult)

 

void IntEndWrite(IAsyncResult ar)

 

Sub IntEndWrite(ar As IAsyncResult)

Parameters:

  • ar:

LastUsed

 

property LastUsed: DateTime read write;

 

DateTime LastUsed { get; set; }

 

Property LastUsed() As DateTime

Length

Length contains the entire known length of the incoming Connection stream. Essentially, it will return the number of bytes that have been previously received (Position) plus the number of bytes that are waiting in the local receive buffer (Available).

 

property Length: Int64 read;

 

Int64 Length { get; }

 

ReadOnly Property Length() As Int64

LF

 

var LF: array of Byte;

 

Byte[] LF

 

FIELD LF() As Byte()

LocalEndPoint

LocalEndPoint specifies the local address that this connection is assigned to. For clients, this will usually be a random port and IP address; for servers, this will be the port and IP address that the connection came in on. Use the RemoteEndPoint property to find out details about the opposite side of the connection.

 

property LocalEndPoint: EndPoint read;

 

EndPoint LocalEndPoint { get; }

 

ReadOnly Property LocalEndPoint() As EndPoint

MaxLineLength

The MaxLineLength property specifies the maximum number of bytes that a ReadLine operation will receive. The maximum line checking can be activated by the MaxLineLengthEnabled property, the default value is 1024 bytes (1kB).

 

property MaxLineLength: Int32 read write;

 

Int32 MaxLineLength { get; set; }

 

Property MaxLineLength() As Int32

MaxLineLengthEnabled

The MaxLineLengthEnabled property toggles whether the ReadLine function will enforce a maximum line length. When turned on (true), ReadLine will fail and the connection will be terminated if the remote side sends a line longer than the defined MaxLineLength bytes.

On Servers MaxLineLengthEnabled is set to true by default for security reasons. This will prevent malicious clients from sending endless strings for servers that read data on a line-by-line basis (for example for HTTP Headers, or the SMTP and POP3 protocols), to prevent clients from wasting server resources by sending strings that exceed the available server memory.

 

property MaxLineLengthEnabled: Boolean read write;

 

Boolean MaxLineLengthEnabled { get; set; }

 

Property MaxLineLengthEnabled() As Boolean

OnBytesReceived

 

event OnBytesReceived: EventHandler;

 

delegate EventHandler OnBytesReceived()

 

Event OnBytesReceived As EventHandler

OnBytesSent

 

event OnBytesSent: EventHandler;

 

delegate EventHandler OnBytesSent()

 

Event OnBytesSent As EventHandler

OriginalEndpoint

 

property OriginalEndpoint: EndPoint read write;

 

EndPoint OriginalEndpoint { get; set; }

 

Property OriginalEndpoint() As EndPoint

Pool

 

property Pool: ConnectionPool read write;

 

ConnectionPool Pool { get; set; }

 

Property Pool() As ConnectionPool

Position

 

property Position: Int64 read write;

 

Int64 Position { get; set; }

 

Property Position() As Int64

Read

The Read method is provided for compatibility with the Stream base class; it behaves identically to Receive. It will block until the entire buffer is filled or the connection has been closed.

 

method Read(buffer: array of Byte; offset: Int32; size: Int32): Int32

 

Int32 Read(Byte[] buffer, Int32 offset, Int32 size)

 

Function Read(buffer As Byte(), offset As Int32, size As Int32) As Int32

Parameters:

  • buffer:
  • offset:
  • size:

ReadLine

ReadLine will read data from the connection until a linebreak (either a CR LF or a single LF) is received.

If MaxLineLengthEnabled is active, ReadLine will take security precautions to ensure the remote side is not sending too long strings.

 

method ReadLine: String

 

String ReadLine()

 

Function ReadLine() As String

Receive (array of Byte): Int32

Receive reads bytes from the connection. This function can be blocked to wait for additional incoming data.

 

method Receive(buffer: array of Byte): Int32

 

Int32 Receive(Byte[] buffer)

 

Function Receive(buffer As Byte()) As Int32

Parameters:

  • buffer:

Receive (array of Byte, Int32, Int32): Int32

 

method Receive(buffer: array of Byte; offset: Int32; size: Int32): Int32

 

Int32 Receive(Byte[] buffer, Int32 offset, Int32 size)

 

Function Receive(buffer As Byte(), offset As Int32, size As Int32) As Int32

Parameters:

  • buffer:
  • offset:
  • size:

ReceiveAllRemaining

 

method ReceiveAllRemaining: array of Byte

 

Byte[] ReceiveAllRemaining()

 

Function ReceiveAllRemaining() As Byte()

ReceiveAllRemaining (Int32): array of Byte

 

method ReceiveAllRemaining(bufferSize: Int32): array of Byte

 

Byte[] ReceiveAllRemaining(Int32 bufferSize)

 

Function ReceiveAllRemaining(bufferSize As Int32) As Byte()

Parameters:

  • bufferSize:

ReceiveToStream (Stream)

 

method ReceiveToStream(stream: Stream)

 

void ReceiveToStream(Stream stream)

 

Sub ReceiveToStream(stream As Stream)

Parameters:

  • stream:

ReceiveToStream (Stream, Int64)

 

method ReceiveToStream(stream: Stream; size: Int64)

 

void ReceiveToStream(Stream stream, Int64 size)

 

Sub ReceiveToStream(stream As Stream, size As Int64)

Parameters:

  • stream:
  • size:

ReceiveToStream (Stream, Int64, Int32)

 

method ReceiveToStream(stream: Stream; size: Int64; bufferSize: Int32)

 

void ReceiveToStream(Stream stream, Int64 size, Int32 bufferSize)

 

Sub ReceiveToStream(stream As Stream, size As Int64, bufferSize As Int32)

Parameters:

  • stream:
  • size:
  • bufferSize:

ReceiveWhatsAvailable

ReceiveWhatsAvailable reads bytes from the connection to fill the passed byte[] buffer. Unlike Receive, this function will not block to wait for additional incoming data, but return immediately with the data that was available.

 

method ReceiveWhatsAvailable(buffer: array of Byte; offset: Int32; size: Int32): Int32

 

Int32 ReceiveWhatsAvailable(Byte[] buffer, Int32 offset, Int32 size)

 

Function ReceiveWhatsAvailable(buffer As Byte(), offset As Int32, size As Int32) As Int32

Parameters:

  • buffer:
  • offset:
  • size:

RemoteEndPoint

RemoteEndPoint specifies the remote address that this connection is assigned to. For clients, this will be the port and IP address that they connected to; for servers, this will usually be a random port on the client, and the IP address of the connected client. Use the LocalEndPoint property to find out details about the local side of the connection.

 

property RemoteEndPoint: EndPoint read;

 

EndPoint RemoteEndPoint { get; }

 

ReadOnly Property RemoteEndPoint() As EndPoint

ResetStatistics

 

method ResetStatistics

 

void ResetStatistics()

 

Sub ResetStatistics()

Secure

 

property Secure: Boolean read;

 

Boolean Secure { get; }

 

ReadOnly Property Secure() As Boolean

Seek

 

method Seek(offset: Int64; origin: SeekOrigin): Int64

 

Int64 Seek(Int64 offset, SeekOrigin origin)

 

Function Seek(offset As Int64, origin As SeekOrigin) As Int64

Parameters:

  • offset:
  • origin:

Send (array of Byte): Int32

This method sends a block of data to the remote side.

 

method Send(buffer: array of Byte): Int32

 

Int32 Send(Byte[] buffer)

 

Function Send(buffer As Byte()) As Int32

Parameters:

  • buffer:

Send (array of Byte, Int32, Int32): Int32

 

method Send(buffer: array of Byte; offset: Int32; size: Int32): Int32

 

Int32 Send(Byte[] buffer, Int32 offset, Int32 size)

 

Function Send(buffer As Byte(), offset As Int32, size As Int32) As Int32

Parameters:

  • buffer:
  • offset:
  • size:

SendFromStream (Stream)

 

method SendFromStream(stream: Stream)

 

void SendFromStream(Stream stream)

 

Sub SendFromStream(stream As Stream)

Parameters:

  • stream:

SendFromStream (Stream, Int64)

 

method SendFromStream(stream: Stream; size: Int64)

 

void SendFromStream(Stream stream, Int64 size)

 

Sub SendFromStream(stream As Stream, size As Int64)

Parameters:

  • stream:
  • size:

SendFromStream (Stream, Int64, Int32)

 

method SendFromStream(stream: Stream; size: Int64; bufferSize: Int32)

 

void SendFromStream(Stream stream, Int64 size, Int32 bufferSize)

 

Sub SendFromStream(stream As Stream, size As Int64, bufferSize As Int32)

Parameters:

  • stream:
  • size:
  • bufferSize:

SetLength

 

method SetLength(length: Int64)

 

void SetLength(Int64 length)

 

Sub SetLength(length As Int64)

Parameters:

  • length:

SkipBytes

 

method SkipBytes(size: Int32)

 

void SkipBytes(Int32 size)

 

Sub SkipBytes(size As Int32)

Parameters:

  • size:

StartTimeoutTimer  protected

 

method StartTimeoutTimer

 

void StartTimeoutTimer()

 

Sub StartTimeoutTimer()

StopTimeoutTimer  protected

 

method StopTimeoutTimer

 

void StopTimeoutTimer()

 

Sub StopTimeoutTimer()

TimedOut

 

property TimedOut: Boolean read;

 

Boolean TimedOut { get; }

 

ReadOnly Property TimedOut() As Boolean

Timeout

The Timeout property specifies the maximum amout of time (in seconds) that a Connection will wait for incoming data within a single Receive operation. The timeout handling can be activated by the TimeoutEnabled property, the default value is 5 minutes.

 

property Timeout: Int32 read write;

 

Int32 Timeout { get; set; }

 

Property Timeout() As Int32

TimeoutEnabled

The TimeoutEnabled property toggles whether the Connection will do automatic timeout checking. When turned on (true), the Connection will keep track of the time that passes during any single Receive operation - if a receive operation takes longer than the given timeout, the connection will be terminated. The Timeout property controls the length of this timeout period. On Servers, TimeoutEnabled is set to true by default for security reasons. This will prevent malicious clients from opening connections and keeping them idling for long periods of time as parts of Denial of Service attacks.

 

property TimeoutEnabled: Boolean read write;

 

Boolean TimeoutEnabled { get; set; }

 

Property TimeoutEnabled() As Boolean

ToString

 

method ToString: String

 

String ToString()

 

Function ToString() As String

TriggerAsyncDisconnect

 

method TriggerAsyncDisconnect

 

void TriggerAsyncDisconnect()

 

Sub TriggerAsyncDisconnect()

TriggerAsyncHaveIncompleteData  protected

 

method TriggerAsyncHaveIncompleteData

 

void TriggerAsyncHaveIncompleteData()

 

Sub TriggerAsyncHaveIncompleteData()

TriggerOnBytesReceived  protected

 

method TriggerOnBytesReceived(count: Int64)

 

void TriggerOnBytesReceived(Int64 count)

 

Sub TriggerOnBytesReceived(count As Int64)

Parameters:

  • count:

TriggerOnBytesSent  protected

 

method TriggerOnBytesSent(count: Int64)

 

void TriggerOnBytesSent(Int64 count)

 

Sub TriggerOnBytesSent(count As Int64)

Parameters:

  • count:

Write

The Write method is provided for compatibility with the Stream base class; it behaves identically to Send.

 

method Write(buffer: array of Byte; offset: Int32; size: Int32)

 

void Write(Byte[] buffer, Int32 offset, Int32 size)

 

Sub Write(buffer As Byte(), offset As Int32, size As Int32)

Parameters:

  • buffer:
  • offset:
  • size:

WriteLine (String)

The WriteLine method is similar to the Write method, but as in-parameter WriteLine it receives a string and finishes writing with carriage-return line feed character CRLF.

 

method WriteLine(line: String)

 

void WriteLine(String line)

 

Sub WriteLine(line As String)

Parameters:

  • line:

WriteLine (String, array of Object)

 

method WriteLine(line: String; params args: array of Object)

 

void WriteLine(String line, params Object[] args)

 

Sub WriteLine(line As String, ParamArray args As Object())

Parameters:

  • line:
  • args:

WriteLineLF (String)

The WriteLineLF method is similar to the Write method, but as in-parameter WriteLineLF it receives a string and finishes writing with line feed character CRLF.

 

method WriteLineLF(line: String)

 

void WriteLineLF(String line)

 

Sub WriteLineLF(line As String)

Parameters:

  • line:

WriteLineLF (String, array of Object)

 

method WriteLineLF(line: String; params args: array of Object)

 

void WriteLineLF(String line, params Object[] args)

 

Sub WriteLineLF(line As String, ParamArray args As Object())

Parameters:

  • line:
  • args:

 

DEFAULT_MAX_LINE_LENGTH

 

const DEFAULT_MAX_LINE_LENGTH: Int32 = 4096;

 

const Int32 DEFAULT_MAX_LINE_LENGTH = 4096

 

Dim DEFAULT_MAX_LINE_LENGTH As Int32 = 4096

DEFAULT_TIMEOUT

 

const DEFAULT_TIMEOUT: Int32 = 300;

 

const Int32 DEFAULT_TIMEOUT = 300

 

Dim DEFAULT_TIMEOUT As Int32 = 300

 

CRLF

 

var CRLF: array of Byte;

 

Byte[] CRLF

 

FIELD CRLF() As Byte()

LF

 

var LF: array of Byte;

 

Byte[] LF

 

FIELD LF() As Byte()

 

Available

Returns the number of bytes available in the local receive buffer.

Override this method in descendant Connection classes if you need to perform additional handling or calculation on the size of available data.

 

property Available: Int32 read;

 

Int32 Available { get; }

 

ReadOnly Property Available() As Int32

Binding

 

property Binding: Binding read;

 

Binding Binding { get; }

 

ReadOnly Property Binding() As Binding

BufferedAsync

 

property BufferedAsync: Boolean read write;

 

Boolean BufferedAsync { get; set; }

 

Property BufferedAsync() As Boolean

BytesReceived

 

property BytesReceived: Int64 read;

 

Int64 BytesReceived { get; }

 

ReadOnly Property BytesReceived() As Int64

BytesSent

 

property BytesSent: Int64 read;

 

Int64 BytesSent { get; }

 

ReadOnly Property BytesSent() As Int64

CanRead

 

property CanRead: Boolean read;

 

Boolean CanRead { get; }

 

ReadOnly Property CanRead() As Boolean

CanSeek

 

property CanSeek: Boolean read;

 

Boolean CanSeek { get; }

 

ReadOnly Property CanSeek() As Boolean

CanWrite

 

property CanWrite: Boolean read;

 

Boolean CanWrite { get; }

 

ReadOnly Property CanWrite() As Boolean

Connected

The boolean Connected property can be evaluated at any given time to find out if the Connection object is referring to an open Connection. When a connection is first obtained, it will be open and the property will be true. Once the connection has been closed, whether purposely or by remote, the property will turn to false.

 

property Connected: Boolean read;

 

Boolean Connected { get; }

 

ReadOnly Property Connected() As Boolean

DataSocket

 

property DataSocket: Socket read;

 

Socket DataSocket { get; }

 

ReadOnly Property DataSocket() As Socket

DataSocketAvailable

 

property DataSocketAvailable: Int32 read;

 

Int32 DataSocketAvailable { get; }

 

ReadOnly Property DataSocketAvailable() As Int32

DataSocketConnected

Specified if the underlying DataSocket is connected.

Override this property in descendant Connection classes if you need additional logic to dertermine if a valid connection is avilable. For example, a secure connection might revert to a disconnected state if certain handshaking with the remote has failed, even though the physical socket is still actually connected.

 

property DataSocketConnected: Boolean read;

 

Boolean DataSocketConnected { get; }

 

ReadOnly Property DataSocketConnected() As Boolean

EnableNagle

 

property EnableNagle: Boolean read write;

 

Boolean EnableNagle { get; set; }

 

Property EnableNagle() As Boolean

Encoding

 

property Encoding: Encoding read write;

 

Encoding Encoding { get; set; }

 

Property Encoding() As Encoding

LastUsed

 

property LastUsed: DateTime read write;

 

DateTime LastUsed { get; set; }

 

Property LastUsed() As DateTime

Length

Length contains the entire known length of the incoming Connection stream. Essentially, it will return the number of bytes that have been previously received (Position) plus the number of bytes that are waiting in the local receive buffer (Available).

 

property Length: Int64 read;

 

Int64 Length { get; }

 

ReadOnly Property Length() As Int64

LocalEndPoint

LocalEndPoint specifies the local address that this connection is assigned to. For clients, this will usually be a random port and IP address; for servers, this will be the port and IP address that the connection came in on. Use the RemoteEndPoint property to find out details about the opposite side of the connection.

 

property LocalEndPoint: EndPoint read;

 

EndPoint LocalEndPoint { get; }

 

ReadOnly Property LocalEndPoint() As EndPoint

MaxLineLength

The MaxLineLength property specifies the maximum number of bytes that a ReadLine operation will receive. The maximum line checking can be activated by the MaxLineLengthEnabled property, the default value is 1024 bytes (1kB).

 

property MaxLineLength: Int32 read write;

 

Int32 MaxLineLength { get; set; }

 

Property MaxLineLength() As Int32

MaxLineLengthEnabled

The MaxLineLengthEnabled property toggles whether the ReadLine function will enforce a maximum line length. When turned on (true), ReadLine will fail and the connection will be terminated if the remote side sends a line longer than the defined MaxLineLength bytes.

On Servers MaxLineLengthEnabled is set to true by default for security reasons. This will prevent malicious clients from sending endless strings for servers that read data on a line-by-line basis (for example for HTTP Headers, or the SMTP and POP3 protocols), to prevent clients from wasting server resources by sending strings that exceed the available server memory.

 

property MaxLineLengthEnabled: Boolean read write;

 

Boolean MaxLineLengthEnabled { get; set; }

 

Property MaxLineLengthEnabled() As Boolean

OriginalEndpoint

 

property OriginalEndpoint: EndPoint read write;

 

EndPoint OriginalEndpoint { get; set; }

 

Property OriginalEndpoint() As EndPoint

Pool

 

property Pool: ConnectionPool read write;

 

ConnectionPool Pool { get; set; }

 

Property Pool() As ConnectionPool

Position

 

property Position: Int64 read write;

 

Int64 Position { get; set; }

 

Property Position() As Int64

RemoteEndPoint

RemoteEndPoint specifies the remote address that this connection is assigned to. For clients, this will be the port and IP address that they connected to; for servers, this will usually be a random port on the client, and the IP address of the connected client. Use the LocalEndPoint property to find out details about the local side of the connection.

 

property RemoteEndPoint: EndPoint read;

 

EndPoint RemoteEndPoint { get; }

 

ReadOnly Property RemoteEndPoint() As EndPoint

Secure

 

property Secure: Boolean read;

 

Boolean Secure { get; }

 

ReadOnly Property Secure() As Boolean

TimedOut

 

property TimedOut: Boolean read;

 

Boolean TimedOut { get; }

 

ReadOnly Property TimedOut() As Boolean

Timeout

The Timeout property specifies the maximum amout of time (in seconds) that a Connection will wait for incoming data within a single Receive operation. The timeout handling can be activated by the TimeoutEnabled property, the default value is 5 minutes.

 

property Timeout: Int32 read write;

 

Int32 Timeout { get; set; }

 

Property Timeout() As Int32

TimeoutEnabled

The TimeoutEnabled property toggles whether the Connection will do automatic timeout checking. When turned on (true), the Connection will keep track of the time that passes during any single Receive operation - if a receive operation takes longer than the given timeout, the connection will be terminated. The Timeout property controls the length of this timeout period. On Servers, TimeoutEnabled is set to true by default for security reasons. This will prevent malicious clients from opening connections and keeping them idling for long periods of time as parts of Denial of Service attacks.

 

property TimeoutEnabled: Boolean read write;

 

Boolean TimeoutEnabled { get; set; }

 

Property TimeoutEnabled() As Boolean

 

constructor (Binding)

 

constructor(binding: Binding)

 

Connection(Binding binding)

 

Sub New(binding As Binding)

Parameters:

  • binding:

constructor (Socket)

 

constructor(socket: Socket)

 

Connection(Socket socket)

 

Sub New(socket As Socket)

Parameters:

  • socket:

BeginConnect (IPAddress, Int32, AsyncCallback, Object): IAsyncResult

 

method BeginConnect(address: IPAddress; port: Int32; callback: AsyncCallback; state: Object): IAsyncResult

 

IAsyncResult BeginConnect(IPAddress address, Int32 port, AsyncCallback callback, Object state)

 

Function BeginConnect(address As IPAddress, port As Int32, callback As AsyncCallback, state As Object) As IAsyncResult

Parameters:

  • address:
  • port:
  • callback:
  • state:

BeginConnect (EndPoint, AsyncCallback, Object): IAsyncResult

 

method BeginConnect(endPoint: EndPoint; callback: AsyncCallback; state: Object): IAsyncResult

 

IAsyncResult BeginConnect(EndPoint endPoint, AsyncCallback callback, Object state)

 

Function BeginConnect(endPoint As EndPoint, callback As AsyncCallback, state As Object) As IAsyncResult

Parameters:

  • endPoint:
  • callback:
  • state:

BeginInitializeServerConnection

 

method BeginInitializeServerConnection(callback: AsyncCallback; state: Object): IAsyncResult

 

IAsyncResult BeginInitializeServerConnection(AsyncCallback callback, Object state)

 

Function BeginInitializeServerConnection(callback As AsyncCallback, state As Object) As IAsyncResult

Parameters:

  • callback:
  • state:

BeginRead

 

method BeginRead(buffer: array of Byte; offset: Int32; count: Int32; callback: AsyncCallback; state: Object): IAsyncResult

 

IAsyncResult BeginRead(Byte[] buffer, Int32 offset, Int32 count, AsyncCallback callback, Object state)

 

Function BeginRead(buffer As Byte(), offset As Int32, count As Int32, callback As AsyncCallback, state As Object) As IAsyncResult

Parameters:

  • buffer:
  • offset:
  • count:
  • callback:
  • state:

BeginReadLine

 

method BeginReadLine(callback: AsyncCallback; state: Object): IAsyncResult

 

IAsyncResult BeginReadLine(AsyncCallback callback, Object state)

 

Function BeginReadLine(callback As AsyncCallback, state As Object) As IAsyncResult

Parameters:

  • callback:
  • state:

BeginWrite

 

method BeginWrite(buffer: array of Byte; offset: Int32; count: Int32; callback: AsyncCallback; state: Object): IAsyncResult

 

IAsyncResult BeginWrite(Byte[] buffer, Int32 offset, Int32 count, AsyncCallback callback, Object state)

 

Function BeginWrite(buffer As Byte(), offset As Int32, count As Int32, callback As AsyncCallback, state As Object) As IAsyncResult

Parameters:

  • buffer:
  • offset:
  • count:
  • callback:
  • state:

BufferReadLine

 

method BufferReadLine: String

 

String BufferReadLine()

 

Function BufferReadLine() As String

Close

Closes the data connection to the remote and terminates any calls to Receive that might still be blocking.

 

method Close

 

void Close()

 

Sub Close()

Connect (IPAddress, Int32)

 

method Connect(address: IPAddress; port: Int32)

 

void Connect(IPAddress address, Int32 port)

 

Sub Connect(address As IPAddress, port As Int32)

Parameters:

  • address:
  • port:

Connect (EndPoint)

Opens a connection to the target remote system.

 

method Connect(endPoint: EndPoint)

 

void Connect(EndPoint endPoint)

 

Sub Connect(endPoint As EndPoint)

Parameters:

  • endPoint:

DataSocketClose  protected

 

method DataSocketClose

 

void DataSocketClose()

 

Sub DataSocketClose()

DataSocketClose (Boolean)  protected

 

method DataSocketClose(dispose: Boolean)

 

void DataSocketClose(Boolean dispose)

 

Sub DataSocketClose(dispose As Boolean)

Parameters:

  • dispose:

DataSocketConnect  protected

 

method DataSocketConnect(endPoint: EndPoint)

 

void DataSocketConnect(EndPoint endPoint)

 

Sub DataSocketConnect(endPoint As EndPoint)

Parameters:

  • endPoint:

DataSocketReceiveWhatsAvailable  protected

 

method DataSocketReceiveWhatsAvailable(buffer: array of Byte; offset: Int32; size: Int32): Int32

 

Int32 DataSocketReceiveWhatsAvailable(Byte[] buffer, Int32 offset, Int32 size)

 

Function DataSocketReceiveWhatsAvailable(buffer As Byte(), offset As Int32, size As Int32) As Int32

Parameters:

  • buffer:
  • offset:
  • size:

DataSocketSend  protected

 

method DataSocketSend(buffer: array of Byte): Int32

 

Int32 DataSocketSend(Byte[] buffer)

 

Function DataSocketSend(buffer As Byte()) As Int32

Parameters:

  • buffer:

DataSocketSendAsMuchAsPossible  protected

 

method DataSocketSendAsMuchAsPossible(buffer: array of Byte; offset: Int32; size: Int32): Int32

 

Int32 DataSocketSendAsMuchAsPossible(Byte[] buffer, Int32 offset, Int32 size)

 

Function DataSocketSendAsMuchAsPossible(buffer As Byte(), offset As Int32, size As Int32) As Int32

Parameters:

  • buffer:
  • offset:
  • size:

Disconnect

Closes the data connection to the remote and terminates any calls to Receive that might still be blocking.

 

method Disconnect

 

void Disconnect()

 

Sub Disconnect()

Dispose

 

method Dispose

 

void Dispose()

 

Sub Dispose()

EndConnect

 

method EndConnect(ar: IAsyncResult)

 

void EndConnect(IAsyncResult ar)

 

Sub EndConnect(ar As IAsyncResult)

Parameters:

  • ar:

EndInitializeServerConnection

 

method EndInitializeServerConnection(ar: IAsyncResult)

 

void EndInitializeServerConnection(IAsyncResult ar)

 

Sub EndInitializeServerConnection(ar As IAsyncResult)

Parameters:

  • ar:

EndRead

 

method EndRead(ar: IAsyncResult): Int32

 

Int32 EndRead(IAsyncResult ar)

 

Function EndRead(ar As IAsyncResult) As Int32

Parameters:

  • ar:

EndReadLine

 

method EndReadLine(ar: IAsyncResult): String

 

String EndReadLine(IAsyncResult ar)

 

Function EndReadLine(ar As IAsyncResult) As String

Parameters:

  • ar:

EndWrite

 

method EndWrite(ar: IAsyncResult)

 

void EndWrite(IAsyncResult ar)

 

Sub EndWrite(ar As IAsyncResult)

Parameters:

  • ar:

Flush

 

method Flush

 

void Flush()

 

Sub Flush()

Init

 

method Init(socket: Socket)

 

void Init(Socket socket)

 

Sub Init(socket As Socket)

Parameters:

  • socket:

InitializeServerConnection

 

method InitializeServerConnection

 

void InitializeServerConnection()

 

Sub InitializeServerConnection()

IntBeginRead  protected

 

method IntBeginRead(buffer: array of Byte; offset: Int32; count: Int32; callback: AsyncCallback; state: Object): IAsyncResult

 

IAsyncResult IntBeginRead(Byte[] buffer, Int32 offset, Int32 count, AsyncCallback callback, Object state)

 

Function IntBeginRead(buffer As Byte(), offset As Int32, count As Int32, callback As AsyncCallback, state As Object) As IAsyncResult

Parameters:

  • buffer:
  • offset:
  • count:
  • callback:
  • state:

IntBeginWrite  protected

 

method IntBeginWrite(buffer: array of Byte; offset: Int32; count: Int32; callback: AsyncCallback; state: Object): IAsyncResult

 

IAsyncResult IntBeginWrite(Byte[] buffer, Int32 offset, Int32 count, AsyncCallback callback, Object state)

 

Function IntBeginWrite(buffer As Byte(), offset As Int32, count As Int32, callback As AsyncCallback, state As Object) As IAsyncResult

Parameters:

  • buffer:
  • offset:
  • count:
  • callback:
  • state:

IntEndRead  protected

 

method IntEndRead(ar: IAsyncResult): Int32

 

Int32 IntEndRead(IAsyncResult ar)

 

Function IntEndRead(ar As IAsyncResult) As Int32

Parameters:

  • ar:

IntEndWrite  protected

 

method IntEndWrite(ar: IAsyncResult)

 

void IntEndWrite(IAsyncResult ar)

 

Sub IntEndWrite(ar As IAsyncResult)

Parameters:

  • ar:

Read

The Read method is provided for compatibility with the Stream base class; it behaves identically to Receive. It will block until the entire buffer is filled or the connection has been closed.

 

method Read(buffer: array of Byte; offset: Int32; size: Int32): Int32

 

Int32 Read(Byte[] buffer, Int32 offset, Int32 size)

 

Function Read(buffer As Byte(), offset As Int32, size As Int32) As Int32

Parameters:

  • buffer:
  • offset:
  • size:

ReadLine

ReadLine will read data from the connection until a linebreak (either a CR LF or a single LF) is received.

If MaxLineLengthEnabled is active, ReadLine will take security precautions to ensure the remote side is not sending too long strings.

 

method ReadLine: String

 

String ReadLine()

 

Function ReadLine() As String

Receive (array of Byte): Int32

Receive reads bytes from the connection. This function can be blocked to wait for additional incoming data.

 

method Receive(buffer: array of Byte): Int32

 

Int32 Receive(Byte[] buffer)

 

Function Receive(buffer As Byte()) As Int32

Parameters:

  • buffer:

Receive (array of Byte, Int32, Int32): Int32

 

method Receive(buffer: array of Byte; offset: Int32; size: Int32): Int32

 

Int32 Receive(Byte[] buffer, Int32 offset, Int32 size)

 

Function Receive(buffer As Byte(), offset As Int32, size As Int32) As Int32

Parameters:

  • buffer:
  • offset:
  • size:

ReceiveAllRemaining

 

method ReceiveAllRemaining: array of Byte

 

Byte[] ReceiveAllRemaining()

 

Function ReceiveAllRemaining() As Byte()

ReceiveAllRemaining (Int32): array of Byte

 

method ReceiveAllRemaining(bufferSize: Int32): array of Byte

 

Byte[] ReceiveAllRemaining(Int32 bufferSize)

 

Function ReceiveAllRemaining(bufferSize As Int32) As Byte()

Parameters:

  • bufferSize:

ReceiveToStream (Stream)

 

method ReceiveToStream(stream: Stream)

 

void ReceiveToStream(Stream stream)

 

Sub ReceiveToStream(stream As Stream)

Parameters:

  • stream:

ReceiveToStream (Stream, Int64)

 

method ReceiveToStream(stream: Stream; size: Int64)

 

void ReceiveToStream(Stream stream, Int64 size)

 

Sub ReceiveToStream(stream As Stream, size As Int64)

Parameters:

  • stream:
  • size:

ReceiveToStream (Stream, Int64, Int32)

 

method ReceiveToStream(stream: Stream; size: Int64; bufferSize: Int32)

 

void ReceiveToStream(Stream stream, Int64 size, Int32 bufferSize)

 

Sub ReceiveToStream(stream As Stream, size As Int64, bufferSize As Int32)

Parameters:

  • stream:
  • size:
  • bufferSize:

ReceiveWhatsAvailable

ReceiveWhatsAvailable reads bytes from the connection to fill the passed byte[] buffer. Unlike Receive, this function will not block to wait for additional incoming data, but return immediately with the data that was available.

 

method ReceiveWhatsAvailable(buffer: array of Byte; offset: Int32; size: Int32): Int32

 

Int32 ReceiveWhatsAvailable(Byte[] buffer, Int32 offset, Int32 size)

 

Function ReceiveWhatsAvailable(buffer As Byte(), offset As Int32, size As Int32) As Int32

Parameters:

  • buffer:
  • offset:
  • size:

ResetStatistics

 

method ResetStatistics

 

void ResetStatistics()

 

Sub ResetStatistics()

Seek

 

method Seek(offset: Int64; origin: SeekOrigin): Int64

 

Int64 Seek(Int64 offset, SeekOrigin origin)

 

Function Seek(offset As Int64, origin As SeekOrigin) As Int64

Parameters:

  • offset:
  • origin:

Send (array of Byte): Int32

This method sends a block of data to the remote side.

 

method Send(buffer: array of Byte): Int32

 

Int32 Send(Byte[] buffer)

 

Function Send(buffer As Byte()) As Int32

Parameters:

  • buffer:

Send (array of Byte, Int32, Int32): Int32

 

method Send(buffer: array of Byte; offset: Int32; size: Int32): Int32

 

Int32 Send(Byte[] buffer, Int32 offset, Int32 size)

 

Function Send(buffer As Byte(), offset As Int32, size As Int32) As Int32

Parameters:

  • buffer:
  • offset:
  • size:

SendFromStream (Stream)

 

method SendFromStream(stream: Stream)

 

void SendFromStream(Stream stream)

 

Sub SendFromStream(stream As Stream)

Parameters:

  • stream:

SendFromStream (Stream, Int64)

 

method SendFromStream(stream: Stream; size: Int64)

 

void SendFromStream(Stream stream, Int64 size)

 

Sub SendFromStream(stream As Stream, size As Int64)

Parameters:

  • stream:
  • size:

SendFromStream (Stream, Int64, Int32)

 

method SendFromStream(stream: Stream; size: Int64; bufferSize: Int32)

 

void SendFromStream(Stream stream, Int64 size, Int32 bufferSize)

 

Sub SendFromStream(stream As Stream, size As Int64, bufferSize As Int32)

Parameters:

  • stream:
  • size:
  • bufferSize:

SetLength

 

method SetLength(length: Int64)

 

void SetLength(Int64 length)

 

Sub SetLength(length As Int64)

Parameters:

  • length:

SkipBytes

 

method SkipBytes(size: Int32)

 

void SkipBytes(Int32 size)

 

Sub SkipBytes(size As Int32)

Parameters:

  • size:

StartTimeoutTimer  protected

 

method StartTimeoutTimer

 

void StartTimeoutTimer()

 

Sub StartTimeoutTimer()

StopTimeoutTimer  protected

 

method StopTimeoutTimer

 

void StopTimeoutTimer()

 

Sub StopTimeoutTimer()

ToString

 

method ToString: String

 

String ToString()

 

Function ToString() As String

TriggerAsyncDisconnect

 

method TriggerAsyncDisconnect

 

void TriggerAsyncDisconnect()

 

Sub TriggerAsyncDisconnect()

TriggerAsyncHaveIncompleteData  protected

 

method TriggerAsyncHaveIncompleteData

 

void TriggerAsyncHaveIncompleteData()

 

Sub TriggerAsyncHaveIncompleteData()

TriggerOnBytesReceived  protected

 

method TriggerOnBytesReceived(count: Int64)

 

void TriggerOnBytesReceived(Int64 count)

 

Sub TriggerOnBytesReceived(count As Int64)

Parameters:

  • count:

TriggerOnBytesSent  protected

 

method TriggerOnBytesSent(count: Int64)

 

void TriggerOnBytesSent(Int64 count)

 

Sub TriggerOnBytesSent(count As Int64)

Parameters:

  • count:

Write

The Write method is provided for compatibility with the Stream base class; it behaves identically to Send.

 

method Write(buffer: array of Byte; offset: Int32; size: Int32)

 

void Write(Byte[] buffer, Int32 offset, Int32 size)

 

Sub Write(buffer As Byte(), offset As Int32, size As Int32)

Parameters:

  • buffer:
  • offset:
  • size:

WriteLine (String)

The WriteLine method is similar to the Write method, but as in-parameter WriteLine it receives a string and finishes writing with carriage-return line feed character CRLF.

 

method WriteLine(line: String)

 

void WriteLine(String line)

 

Sub WriteLine(line As String)

Parameters:

  • line:

WriteLine (String, array of Object)

 

method WriteLine(line: String; params args: array of Object)

 

void WriteLine(String line, params Object[] args)

 

Sub WriteLine(line As String, ParamArray args As Object())

Parameters:

  • line:
  • args:

WriteLineLF (String)

The WriteLineLF method is similar to the Write method, but as in-parameter WriteLineLF it receives a string and finishes writing with line feed character CRLF.

 

method WriteLineLF(line: String)

 

void WriteLineLF(String line)

 

Sub WriteLineLF(line As String)

Parameters:

  • line:

WriteLineLF (String, array of Object)

 

method WriteLineLF(line: String; params args: array of Object)

 

void WriteLineLF(String line, params Object[] args)

 

Sub WriteLineLF(line As String, ParamArray args As Object())

Parameters:

  • line:
  • args:

 

AsyncDisconnect

 

event AsyncDisconnect: EventHandler;

 

delegate EventHandler AsyncDisconnect()

 

Event AsyncDisconnect As EventHandler

AsyncHaveIncompleteData

 

event AsyncHaveIncompleteData: EventHandler;

 

delegate EventHandler AsyncHaveIncompleteData()

 

Event AsyncHaveIncompleteData As EventHandler

OnBytesReceived

 

event OnBytesReceived: EventHandler;

 

delegate EventHandler OnBytesReceived()

 

Event OnBytesReceived As EventHandler

OnBytesSent

 

event OnBytesSent: EventHandler;

 

delegate EventHandler OnBytesSent()

 

Event OnBytesSent As EventHandler