HttpSslConnection

Overview

The HttpSslConnection class represents SSL-protected HTTP connection from client to the server.

Instances of this class are internally used by the IpHttpClientChannel and IpSuperHttpClientChannel classes to encapsulate HTTP connections.

Connections represented by the HttpSslConnection class are able to establish SSL tunnel connection (ie to connect to the server via HTTP proxy servers).

Location


 

constructor (Binding)    (declared in Connection)

 

constructor(binding: Binding)

 

HttpSslConnection(Binding binding)

 

Sub New(binding As Binding)

Parameters:

  • binding:

Creates a new instance of the HttpSslConnection class. Connection uses network socket created based on the provided binding information.

Provided factory instance implements all SSL-specific methods like certificate validation and client authentication, as well as provides HTTP proxy server settings.

 

constructor(factory: HttpsConnectionFactory; binding: Binding)

 

HttpSslConnection(HttpsConnectionFactory factory, Binding binding)

 

Sub New(factory As HttpsConnectionFactory, binding As Binding)

Parameters:

  • factory: HttpsConnectionFactory instance that provides all SSL authentication and certificate validation
  • binding: Binding instance that provides network protocol and endpoint information needed to establish a network connection

Creates a new instance of the HttpSslConnection class. Provided connection instance will be used to perform data transfers.

Provided factory instance implements all SSL-specific methods like certificate validation and client authentication, as well as provides HTTP proxy server settings.

 

constructor(factory: HttpsConnectionFactory; connection: Connection)

 

HttpSslConnection(HttpsConnectionFactory factory, Connection connection)

 

Sub New(factory As HttpsConnectionFactory, connection As Connection)

Parameters:

  • factory: HttpsConnectionFactory instance that provides all SSL authentication and certificate validation
  • connection: Connection that will be used for data transfers

constructor (HttpsConnectionFactory, Socket)

Creates a new instance of the HttpSslConnection class. All data transfers will use provided socket instance.

Provided factory instance implements all SSL-specific methods like certificate validation and client authentication, as well as provides HTTP proxy server settings.

 

constructor(factory: HttpsConnectionFactory; socket: Socket)

 

HttpSslConnection(HttpsConnectionFactory factory, Socket socket)

 

Sub New(factory As HttpsConnectionFactory, socket As Socket)

Parameters:

  • factory: HttpsConnectionFactory instance that provides all SSL authentication and certificate validation
  • socket: Network socket that will be used for data transfers

constructor (SslConnectionFactory, Binding)    (declared in SslConnection)

Creates a new instance of this class.

 

constructor(factory: SslConnectionFactory; binding: Binding)

 

HttpSslConnection(SslConnectionFactory factory, Binding binding)

 

Sub New(factory As SslConnectionFactory, binding As Binding)

Parameters:

  • factory:
  • binding:

constructor (SslConnectionFactory, Connection)    (declared in SslConnection)

 

constructor(factory: SslConnectionFactory; connection: Connection)

 

HttpSslConnection(SslConnectionFactory factory, Connection connection)

 

Sub New(factory As SslConnectionFactory, connection As Connection)

Parameters:

  • factory:
  • connection:

constructor (SslConnectionFactory, Socket)    (declared in SslConnection)

 

constructor(factory: SslConnectionFactory; socket: Socket)

 

HttpSslConnection(SslConnectionFactory factory, Socket socket)

 

Sub New(factory As SslConnectionFactory, socket As Socket)

Parameters:

  • factory:
  • socket:

constructor (Socket)    (declared in Connection)

 

constructor(socket: Socket)

 

HttpSslConnection(Socket socket)

 

Sub New(socket As Socket)

Parameters:

  • socket:

AsyncDisconnect    (declared in Connection)

 

event AsyncDisconnect: EventHandler;

 

delegate EventHandler AsyncDisconnect()

 

Event AsyncDisconnect As EventHandler

AsyncHaveIncompleteData    (declared in Connection)

 

event AsyncHaveIncompleteData: EventHandler;

 

delegate EventHandler AsyncHaveIncompleteData()

 

Event AsyncHaveIncompleteData As EventHandler

Available    (declared in Connection)

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    (declared in SslConnection)

 

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    (declared in SslConnection)

Connects asynchronously to a remote server.

 

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: Callback for when the connection has connected or failed.
  • state: User data reference.

BeginInitializeClientConnection  protected

Asynchonously initializes SSL-protected connection to the server.

Opens SSL tonnel connection if needed.

Note: This method uses synchronous calls to establish a SSL tunnel, so it still can take considerable amount of time to complete it.

 

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

 

IAsyncResult BeginInitializeClientConnection(AsyncCallback callback, Object state)

 

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

Parameters:

  • callback:
  • state: State object that will be passed to the cb callback delegate

BeginInitializeServerConnection    (declared in SslConnection)

Asynchronously accepts a server socket and returns a callback when the TLS handshake was acknowledged.

 

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    (declared in Connection)

 

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    (declared in Connection)

 

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    (declared in Connection)

 

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    (declared in Connection)

 

property Binding: Binding read;

 

Binding Binding { get; }

 

ReadOnly Property Binding() As Binding

BufferedAsync    (declared in Connection)

 

property BufferedAsync: Boolean read write;

 

Boolean BufferedAsync { get; set; }

 

Property BufferedAsync() As Boolean

BufferReadLine    (declared in Connection)

 

method BufferReadLine: String

 

String BufferReadLine()

 

Function BufferReadLine() As String

BytesReceived    (declared in Connection)

 

property BytesReceived: Int64 read;

 

Int64 BytesReceived { get; }

 

ReadOnly Property BytesReceived() As Int64

BytesSent    (declared in Connection)

 

property BytesSent: Int64 read;

 

Int64 BytesSent { get; }

 

ReadOnly Property BytesSent() As Int64

CanRead    (declared in Connection)

 

property CanRead: Boolean read;

 

Boolean CanRead { get; }

 

ReadOnly Property CanRead() As Boolean

CanSeek    (declared in Connection)

 

property CanSeek: Boolean read;

 

Boolean CanSeek { get; }

 

ReadOnly Property CanSeek() As Boolean

CanWrite    (declared in Connection)

 

property CanWrite: Boolean read;

 

Boolean CanWrite { get; }

 

ReadOnly Property CanWrite() As Boolean

Close    (declared in Connection)

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)    (declared in SslConnection)

 

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)    (declared in SslConnection)

Connects to a remote end point and waits.

 

method Connect(endPoint: EndPoint)

 

void Connect(EndPoint endPoint)

 

Sub Connect(endPoint As EndPoint)

Parameters:

  • endPoint:

Connected    (declared in Connection)

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    (declared in Connection)

 

var CRLF: array of Byte;

 

Byte[] CRLF

 

FIELD CRLF() As Byte()

DataSocket    (declared in SslConnection)

The socket used to talk to the remote end point.

 

property DataSocket: Socket read;

 

Socket DataSocket { get; }

 

ReadOnly Property DataSocket() As Socket

DataSocketAvailable    (declared in SslConnection)

Returns the number of bytes available from the remote side.

 

property DataSocketAvailable: Int32 read;

 

Int32 DataSocketAvailable { get; }

 

ReadOnly Property DataSocketAvailable() As Int32

DataSocketClose  protected    (declared in SslConnection)

Disconnects from the remote end point and optionally disposes the socket.

 

method DataSocketClose

 

void DataSocketClose()

 

Sub DataSocketClose()

DataSocketClose (Boolean)  protected    (declared in SslConnection)

 

method DataSocketClose(dispose: Boolean)

 

void DataSocketClose(Boolean dispose)

 

Sub DataSocketClose(dispose As Boolean)

Parameters:

  • dispose:

DataSocketConnect  protected    (declared in Connection)

 

method DataSocketConnect(endPoint: EndPoint)

 

void DataSocketConnect(EndPoint endPoint)

 

Sub DataSocketConnect(endPoint As EndPoint)

Parameters:

  • endPoint:

DataSocketConnected    (declared in SslConnection)

Contains true when the socket has not been disconnected yet.

 

property DataSocketConnected: Boolean read;

 

Boolean DataSocketConnected { get; }

 

ReadOnly Property DataSocketConnected() As Boolean

DataSocketReceiveWhatsAvailable  protected    (declared in SslConnection)

 

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    (declared in Connection)

 

method DataSocketSend(buffer: array of Byte): Int32

 

Int32 DataSocketSend(Byte[] buffer)

 

Function DataSocketSend(buffer As Byte()) As Int32

Parameters:

  • buffer:

DataSocketSendAsMuchAsPossible  protected    (declared in SslConnection)

Sends a data packet or part of it and returns how many bytes were sent.

 

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    (declared in Connection)

 

const DEFAULT_MAX_LINE_LENGTH: Int32 = 4096;

 

const Int32 DEFAULT_MAX_LINE_LENGTH = 4096

 

Dim DEFAULT_MAX_LINE_LENGTH As Int32 = 4096

DEFAULT_TIMEOUT    (declared in Connection)

 

const DEFAULT_TIMEOUT: Int32 = 300;

 

const Int32 DEFAULT_TIMEOUT = 300

 

Dim DEFAULT_TIMEOUT As Int32 = 300

Disconnect    (declared in Connection)

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    (declared in Connection)

 

method Dispose

 

void Dispose()

 

Sub Dispose()

EnableNagle    (declared in SslConnection)

When set to true, this property will use the Nagle algorithm to send multiple packages in one block instead of sending each individually.

 

property EnableNagle: Boolean read write;

 

Boolean EnableNagle { get; set; }

 

Property EnableNagle() As Boolean

Encoding    (declared in Connection)

 

property Encoding: Encoding read write;

 

Encoding Encoding { get; set; }

 

Property Encoding() As Encoding

EndConnect    (declared in SslConnection)

EndConnect is meant to be called from the callback which is passed to BeginConnect. It will finalize the connection handshake and either succeed or return an exception if something fails.

 

method EndConnect(ar: IAsyncResult)

 

void EndConnect(IAsyncResult ar)

 

Sub EndConnect(ar As IAsyncResult)

Parameters:

  • ar:

EndInitializeClientConnection  protected    (declared in SslConnection)

 

method EndInitializeClientConnection(ar: IAsyncResult)

 

void EndInitializeClientConnection(IAsyncResult ar)

 

Sub EndInitializeClientConnection(ar As IAsyncResult)

Parameters:

  • ar:

EndInitializeServerConnection    (declared in SslConnection)

Finalizes the server connection initialization and returns an exception if the handshake could not be established or succeeds if it could.

 

method EndInitializeServerConnection(ar: IAsyncResult)

 

void EndInitializeServerConnection(IAsyncResult ar)

 

Sub EndInitializeServerConnection(ar As IAsyncResult)

Parameters:

  • ar: The async result passed in as a parameter to the callback.

EndRead    (declared in Connection)

 

method EndRead(ar: IAsyncResult): Int32

 

Int32 EndRead(IAsyncResult ar)

 

Function EndRead(ar As IAsyncResult) As Int32

Parameters:

  • ar:

EndReadLine    (declared in Connection)

 

method EndReadLine(ar: IAsyncResult): String

 

String EndReadLine(IAsyncResult ar)

 

Function EndReadLine(ar As IAsyncResult) As String

Parameters:

  • ar:

EndWrite    (declared in Connection)

 

method EndWrite(ar: IAsyncResult)

 

void EndWrite(IAsyncResult ar)

 

Sub EndWrite(ar As IAsyncResult)

Parameters:

  • ar:

Flush    (declared in Connection)

 

method Flush

 

void Flush()

 

Sub Flush()

Init    (declared in Connection)

 

method Init(socket: Socket)

 

void Init(Socket socket)

 

Sub Init(socket As Socket)

Parameters:

  • socket:

InitializeClientConnection

Initializes SSL-protected connection to the server.

Opens SSL tonnel connection if needed.

 

method InitializeClientConnection

 

void InitializeClientConnection()

 

Sub InitializeClientConnection()

InitializeServerConnection    (declared in SslConnection)

Initializes the server handshake and waits until it's done.

 

method InitializeServerConnection

 

void InitializeServerConnection()

 

Sub InitializeServerConnection()

IntBeginRead  protected    (declared in SslConnection)

Internal method to receive data asynchronously. Should not be called directly.

 

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: Buffer to read into.
  • offset: The offset to start at.
  • count: The number of bytes to read.
  • callback: Callback to call when it's done reading.
  • state: Userdata pointer.

IntBeginWrite  protected    (declared in SslConnection)

Internal method to send data asynchronously. Should not be called directly.

 

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: Buffer to send.
  • offset: Offset to start at.
  • count: The number of bytes to send.
  • callback: The callback to call when the data has been sent.
  • state: Userdata pointer.

IntEndRead  protected    (declared in SslConnection)

This method is meant to be called from the callback passed to IntBeginRead and returns the number of bytes read.

 

method IntEndRead(ar: IAsyncResult): Int32

 

Int32 IntEndRead(IAsyncResult ar)

 

Function IntEndRead(ar As IAsyncResult) As Int32

Parameters:

  • ar: Async result passed as a parameter to the callback.

IntEndWrite  protected    (declared in SslConnection)

This method is meant to be called from the callback passed to IntBeginWrite.

 

method IntEndWrite(ar: IAsyncResult)

 

void IntEndWrite(IAsyncResult ar)

 

Sub IntEndWrite(ar As IAsyncResult)

Parameters:

  • ar:

LastUsed    (declared in Connection)

 

property LastUsed: DateTime read write;

 

DateTime LastUsed { get; set; }

 

Property LastUsed() As DateTime

Length    (declared in Connection)

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    (declared in Connection)

 

var LF: array of Byte;

 

Byte[] LF

 

FIELD LF() As Byte()

LocalEndPoint    (declared in Connection)

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    (declared in Connection)

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    (declared in Connection)

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    (declared in Connection)

 

event OnBytesReceived: EventHandler;

 

delegate EventHandler OnBytesReceived()

 

Event OnBytesReceived As EventHandler

OnBytesSent    (declared in Connection)

 

event OnBytesSent: EventHandler;

 

delegate EventHandler OnBytesSent()

 

Event OnBytesSent As EventHandler

OriginalEndpoint    (declared in Connection)

 

property OriginalEndpoint: EndPoint read write;

 

EndPoint OriginalEndpoint { get; set; }

 

Property OriginalEndpoint() As EndPoint

Pool    (declared in Connection)

 

property Pool: ConnectionPool read write;

 

ConnectionPool Pool { get; set; }

 

Property Pool() As ConnectionPool

Position    (declared in Connection)

 

property Position: Int64 read write;

 

Int64 Position { get; set; }

 

Property Position() As Int64

Read    (declared in Connection)

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    (declared in Connection)

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    (declared in Connection)

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    (declared in Connection)

 

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    (declared in Connection)

 

method ReceiveAllRemaining: array of Byte

 

Byte[] ReceiveAllRemaining()

 

Function ReceiveAllRemaining() As Byte()

ReceiveAllRemaining (Int32): array of Byte    (declared in Connection)

 

method ReceiveAllRemaining(bufferSize: Int32): array of Byte

 

Byte[] ReceiveAllRemaining(Int32 bufferSize)

 

Function ReceiveAllRemaining(bufferSize As Int32) As Byte()

Parameters:

  • bufferSize:

ReceiveToStream (Stream)    (declared in Connection)

 

method ReceiveToStream(stream: Stream)

 

void ReceiveToStream(Stream stream)

 

Sub ReceiveToStream(stream As Stream)

Parameters:

  • stream:

ReceiveToStream (Stream, Int64)    (declared in Connection)

 

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)    (declared in Connection)

 

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    (declared in Connection)

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    (declared in Connection)

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    (declared in Connection)

 

method ResetStatistics

 

void ResetStatistics()

 

Sub ResetStatistics()

Secure    (declared in SslConnection)

 

property Secure: Boolean read;

 

Boolean Secure { get; }

 

ReadOnly Property Secure() As Boolean

Seek    (declared in Connection)

 

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    (declared in Connection)

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    (declared in Connection)

 

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)    (declared in Connection)

 

method SendFromStream(stream: Stream)

 

void SendFromStream(Stream stream)

 

Sub SendFromStream(stream As Stream)

Parameters:

  • stream:

SendFromStream (Stream, Int64)    (declared in Connection)

 

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)    (declared in Connection)

 

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    (declared in Connection)

 

method SetLength(length: Int64)

 

void SetLength(Int64 length)

 

Sub SetLength(length As Int64)

Parameters:

  • length:

SkipBytes    (declared in Connection)

 

method SkipBytes(size: Int32)

 

void SkipBytes(Int32 size)

 

Sub SkipBytes(size As Int32)

Parameters:

  • size:

StartTimeoutTimer  protected    (declared in Connection)

 

method StartTimeoutTimer

 

void StartTimeoutTimer()

 

Sub StartTimeoutTimer()

StopTimeoutTimer  protected    (declared in Connection)

 

method StopTimeoutTimer

 

void StopTimeoutTimer()

 

Sub StopTimeoutTimer()

TimedOut    (declared in Connection)

 

property TimedOut: Boolean read;

 

Boolean TimedOut { get; }

 

ReadOnly Property TimedOut() As Boolean

Timeout    (declared in Connection)

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    (declared in Connection)

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    (declared in Connection)

 

method ToString: String

 

String ToString()

 

Function ToString() As String

TriggerAsyncDisconnect    (declared in Connection)

 

method TriggerAsyncDisconnect

 

void TriggerAsyncDisconnect()

 

Sub TriggerAsyncDisconnect()

TriggerAsyncHaveIncompleteData  protected    (declared in Connection)

 

method TriggerAsyncHaveIncompleteData

 

void TriggerAsyncHaveIncompleteData()

 

Sub TriggerAsyncHaveIncompleteData()

TriggerOnBytesReceived  protected    (declared in Connection)

 

method TriggerOnBytesReceived(count: Int64)

 

void TriggerOnBytesReceived(Int64 count)

 

Sub TriggerOnBytesReceived(count As Int64)

Parameters:

  • count:

TriggerOnBytesSent  protected    (declared in Connection)

 

method TriggerOnBytesSent(count: Int64)

 

void TriggerOnBytesSent(Int64 count)

 

Sub TriggerOnBytesSent(count As Int64)

Parameters:

  • count:

Write    (declared in Connection)

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)    (declared in Connection)

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)    (declared in Connection)

 

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)    (declared in Connection)

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)    (declared in Connection)

 

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    (declared in Connection)

 

const DEFAULT_MAX_LINE_LENGTH: Int32 = 4096;

 

const Int32 DEFAULT_MAX_LINE_LENGTH = 4096

 

Dim DEFAULT_MAX_LINE_LENGTH As Int32 = 4096

DEFAULT_TIMEOUT    (declared in Connection)

 

const DEFAULT_TIMEOUT: Int32 = 300;

 

const Int32 DEFAULT_TIMEOUT = 300

 

Dim DEFAULT_TIMEOUT As Int32 = 300

 

CRLF    (declared in Connection)

 

var CRLF: array of Byte;

 

Byte[] CRLF

 

FIELD CRLF() As Byte()

LF    (declared in Connection)

 

var LF: array of Byte;

 

Byte[] LF

 

FIELD LF() As Byte()

 

Available    (declared in Connection)

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    (declared in Connection)

 

property Binding: Binding read;

 

Binding Binding { get; }

 

ReadOnly Property Binding() As Binding

BufferedAsync    (declared in Connection)

 

property BufferedAsync: Boolean read write;

 

Boolean BufferedAsync { get; set; }

 

Property BufferedAsync() As Boolean

BytesReceived    (declared in Connection)

 

property BytesReceived: Int64 read;

 

Int64 BytesReceived { get; }

 

ReadOnly Property BytesReceived() As Int64

BytesSent    (declared in Connection)

 

property BytesSent: Int64 read;

 

Int64 BytesSent { get; }

 

ReadOnly Property BytesSent() As Int64

CanRead    (declared in Connection)

 

property CanRead: Boolean read;

 

Boolean CanRead { get; }

 

ReadOnly Property CanRead() As Boolean

CanSeek    (declared in Connection)

 

property CanSeek: Boolean read;

 

Boolean CanSeek { get; }

 

ReadOnly Property CanSeek() As Boolean

CanWrite    (declared in Connection)

 

property CanWrite: Boolean read;

 

Boolean CanWrite { get; }

 

ReadOnly Property CanWrite() As Boolean

Connected    (declared in Connection)

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    (declared in SslConnection)

The socket used to talk to the remote end point.

 

property DataSocket: Socket read;

 

Socket DataSocket { get; }

 

ReadOnly Property DataSocket() As Socket

DataSocketAvailable    (declared in SslConnection)

Returns the number of bytes available from the remote side.

 

property DataSocketAvailable: Int32 read;

 

Int32 DataSocketAvailable { get; }

 

ReadOnly Property DataSocketAvailable() As Int32

DataSocketConnected    (declared in SslConnection)

Contains true when the socket has not been disconnected yet.

 

property DataSocketConnected: Boolean read;

 

Boolean DataSocketConnected { get; }

 

ReadOnly Property DataSocketConnected() As Boolean

EnableNagle    (declared in SslConnection)

When set to true, this property will use the Nagle algorithm to send multiple packages in one block instead of sending each individually.

 

property EnableNagle: Boolean read write;

 

Boolean EnableNagle { get; set; }

 

Property EnableNagle() As Boolean

Encoding    (declared in Connection)

 

property Encoding: Encoding read write;

 

Encoding Encoding { get; set; }

 

Property Encoding() As Encoding

LastUsed    (declared in Connection)

 

property LastUsed: DateTime read write;

 

DateTime LastUsed { get; set; }

 

Property LastUsed() As DateTime

Length    (declared in Connection)

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    (declared in Connection)

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    (declared in Connection)

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    (declared in Connection)

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    (declared in Connection)

 

property OriginalEndpoint: EndPoint read write;

 

EndPoint OriginalEndpoint { get; set; }

 

Property OriginalEndpoint() As EndPoint

Pool    (declared in Connection)

 

property Pool: ConnectionPool read write;

 

ConnectionPool Pool { get; set; }

 

Property Pool() As ConnectionPool

Position    (declared in Connection)

 

property Position: Int64 read write;

 

Int64 Position { get; set; }

 

Property Position() As Int64

RemoteEndPoint    (declared in Connection)

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    (declared in SslConnection)

 

property Secure: Boolean read;

 

Boolean Secure { get; }

 

ReadOnly Property Secure() As Boolean

TimedOut    (declared in Connection)

 

property TimedOut: Boolean read;

 

Boolean TimedOut { get; }

 

ReadOnly Property TimedOut() As Boolean

Timeout    (declared in Connection)

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    (declared in Connection)

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)    (declared in Connection)

 

constructor(binding: Binding)

 

HttpSslConnection(Binding binding)

 

Sub New(binding As Binding)

Parameters:

  • binding:

Creates a new instance of the HttpSslConnection class. Connection uses network socket created based on the provided binding information.

Provided factory instance implements all SSL-specific methods like certificate validation and client authentication, as well as provides HTTP proxy server settings.

 

constructor(factory: HttpsConnectionFactory; binding: Binding)

 

HttpSslConnection(HttpsConnectionFactory factory, Binding binding)

 

Sub New(factory As HttpsConnectionFactory, binding As Binding)

Parameters:

  • factory: HttpsConnectionFactory instance that provides all SSL authentication and certificate validation
  • binding: Binding instance that provides network protocol and endpoint information needed to establish a network connection

Creates a new instance of the HttpSslConnection class. Provided connection instance will be used to perform data transfers.

Provided factory instance implements all SSL-specific methods like certificate validation and client authentication, as well as provides HTTP proxy server settings.

 

constructor(factory: HttpsConnectionFactory; connection: Connection)

 

HttpSslConnection(HttpsConnectionFactory factory, Connection connection)

 

Sub New(factory As HttpsConnectionFactory, connection As Connection)

Parameters:

  • factory: HttpsConnectionFactory instance that provides all SSL authentication and certificate validation
  • connection: Connection that will be used for data transfers

constructor (HttpsConnectionFactory, Socket)

Creates a new instance of the HttpSslConnection class. All data transfers will use provided socket instance.

Provided factory instance implements all SSL-specific methods like certificate validation and client authentication, as well as provides HTTP proxy server settings.

 

constructor(factory: HttpsConnectionFactory; socket: Socket)

 

HttpSslConnection(HttpsConnectionFactory factory, Socket socket)

 

Sub New(factory As HttpsConnectionFactory, socket As Socket)

Parameters:

  • factory: HttpsConnectionFactory instance that provides all SSL authentication and certificate validation
  • socket: Network socket that will be used for data transfers

constructor (SslConnectionFactory, Binding)    (declared in SslConnection)

Creates a new instance of this class.

 

constructor(factory: SslConnectionFactory; binding: Binding)

 

HttpSslConnection(SslConnectionFactory factory, Binding binding)

 

Sub New(factory As SslConnectionFactory, binding As Binding)

Parameters:

  • factory:
  • binding:

constructor (SslConnectionFactory, Connection)    (declared in SslConnection)

 

constructor(factory: SslConnectionFactory; connection: Connection)

 

HttpSslConnection(SslConnectionFactory factory, Connection connection)

 

Sub New(factory As SslConnectionFactory, connection As Connection)

Parameters:

  • factory:
  • connection:

constructor (SslConnectionFactory, Socket)    (declared in SslConnection)

 

constructor(factory: SslConnectionFactory; socket: Socket)

 

HttpSslConnection(SslConnectionFactory factory, Socket socket)

 

Sub New(factory As SslConnectionFactory, socket As Socket)

Parameters:

  • factory:
  • socket:

constructor (Socket)    (declared in Connection)

 

constructor(socket: Socket)

 

HttpSslConnection(Socket socket)

 

Sub New(socket As Socket)

Parameters:

  • socket:

BeginConnect (IPAddress, Int32, AsyncCallback, Object): IAsyncResult    (declared in SslConnection)

 

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    (declared in SslConnection)

Connects asynchronously to a remote server.

 

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: Callback for when the connection has connected or failed.
  • state: User data reference.

BeginInitializeClientConnection  protected

Asynchonously initializes SSL-protected connection to the server.

Opens SSL tonnel connection if needed.

Note: This method uses synchronous calls to establish a SSL tunnel, so it still can take considerable amount of time to complete it.

 

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

 

IAsyncResult BeginInitializeClientConnection(AsyncCallback callback, Object state)

 

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

Parameters:

  • callback:
  • state: State object that will be passed to the cb callback delegate

BeginInitializeServerConnection    (declared in SslConnection)

Asynchronously accepts a server socket and returns a callback when the TLS handshake was acknowledged.

 

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    (declared in Connection)

 

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    (declared in Connection)

 

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    (declared in Connection)

 

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    (declared in Connection)

 

method BufferReadLine: String

 

String BufferReadLine()

 

Function BufferReadLine() As String

Close    (declared in Connection)

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)    (declared in SslConnection)

 

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)    (declared in SslConnection)

Connects to a remote end point and waits.

 

method Connect(endPoint: EndPoint)

 

void Connect(EndPoint endPoint)

 

Sub Connect(endPoint As EndPoint)

Parameters:

  • endPoint:

DataSocketClose  protected    (declared in SslConnection)

Disconnects from the remote end point and optionally disposes the socket.

 

method DataSocketClose

 

void DataSocketClose()

 

Sub DataSocketClose()

DataSocketClose (Boolean)  protected    (declared in SslConnection)

 

method DataSocketClose(dispose: Boolean)

 

void DataSocketClose(Boolean dispose)

 

Sub DataSocketClose(dispose As Boolean)

Parameters:

  • dispose:

DataSocketConnect  protected    (declared in Connection)

 

method DataSocketConnect(endPoint: EndPoint)

 

void DataSocketConnect(EndPoint endPoint)

 

Sub DataSocketConnect(endPoint As EndPoint)

Parameters:

  • endPoint:

DataSocketReceiveWhatsAvailable  protected    (declared in SslConnection)

 

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    (declared in Connection)

 

method DataSocketSend(buffer: array of Byte): Int32

 

Int32 DataSocketSend(Byte[] buffer)

 

Function DataSocketSend(buffer As Byte()) As Int32

Parameters:

  • buffer:

DataSocketSendAsMuchAsPossible  protected    (declared in SslConnection)

Sends a data packet or part of it and returns how many bytes were sent.

 

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    (declared in Connection)

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    (declared in Connection)

 

method Dispose

 

void Dispose()

 

Sub Dispose()

EndConnect    (declared in SslConnection)

EndConnect is meant to be called from the callback which is passed to BeginConnect. It will finalize the connection handshake and either succeed or return an exception if something fails.

 

method EndConnect(ar: IAsyncResult)

 

void EndConnect(IAsyncResult ar)

 

Sub EndConnect(ar As IAsyncResult)

Parameters:

  • ar:

EndInitializeClientConnection  protected    (declared in SslConnection)

 

method EndInitializeClientConnection(ar: IAsyncResult)

 

void EndInitializeClientConnection(IAsyncResult ar)

 

Sub EndInitializeClientConnection(ar As IAsyncResult)

Parameters:

  • ar:

EndInitializeServerConnection    (declared in SslConnection)

Finalizes the server connection initialization and returns an exception if the handshake could not be established or succeeds if it could.

 

method EndInitializeServerConnection(ar: IAsyncResult)

 

void EndInitializeServerConnection(IAsyncResult ar)

 

Sub EndInitializeServerConnection(ar As IAsyncResult)

Parameters:

  • ar: The async result passed in as a parameter to the callback.

EndRead    (declared in Connection)

 

method EndRead(ar: IAsyncResult): Int32

 

Int32 EndRead(IAsyncResult ar)

 

Function EndRead(ar As IAsyncResult) As Int32

Parameters:

  • ar:

EndReadLine    (declared in Connection)

 

method EndReadLine(ar: IAsyncResult): String

 

String EndReadLine(IAsyncResult ar)

 

Function EndReadLine(ar As IAsyncResult) As String

Parameters:

  • ar:

EndWrite    (declared in Connection)

 

method EndWrite(ar: IAsyncResult)

 

void EndWrite(IAsyncResult ar)

 

Sub EndWrite(ar As IAsyncResult)

Parameters:

  • ar:

Flush    (declared in Connection)

 

method Flush

 

void Flush()

 

Sub Flush()

Init    (declared in Connection)

 

method Init(socket: Socket)

 

void Init(Socket socket)

 

Sub Init(socket As Socket)

Parameters:

  • socket:

InitializeClientConnection

Initializes SSL-protected connection to the server.

Opens SSL tonnel connection if needed.

 

method InitializeClientConnection

 

void InitializeClientConnection()

 

Sub InitializeClientConnection()

InitializeServerConnection    (declared in SslConnection)

Initializes the server handshake and waits until it's done.

 

method InitializeServerConnection

 

void InitializeServerConnection()

 

Sub InitializeServerConnection()

IntBeginRead  protected    (declared in SslConnection)

Internal method to receive data asynchronously. Should not be called directly.

 

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: Buffer to read into.
  • offset: The offset to start at.
  • count: The number of bytes to read.
  • callback: Callback to call when it's done reading.
  • state: Userdata pointer.

IntBeginWrite  protected    (declared in SslConnection)

Internal method to send data asynchronously. Should not be called directly.

 

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: Buffer to send.
  • offset: Offset to start at.
  • count: The number of bytes to send.
  • callback: The callback to call when the data has been sent.
  • state: Userdata pointer.

IntEndRead  protected    (declared in SslConnection)

This method is meant to be called from the callback passed to IntBeginRead and returns the number of bytes read.

 

method IntEndRead(ar: IAsyncResult): Int32

 

Int32 IntEndRead(IAsyncResult ar)

 

Function IntEndRead(ar As IAsyncResult) As Int32

Parameters:

  • ar: Async result passed as a parameter to the callback.

IntEndWrite  protected    (declared in SslConnection)

This method is meant to be called from the callback passed to IntBeginWrite.

 

method IntEndWrite(ar: IAsyncResult)

 

void IntEndWrite(IAsyncResult ar)

 

Sub IntEndWrite(ar As IAsyncResult)

Parameters:

  • ar:

Read    (declared in Connection)

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    (declared in Connection)

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    (declared in Connection)

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    (declared in Connection)

 

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    (declared in Connection)

 

method ReceiveAllRemaining: array of Byte

 

Byte[] ReceiveAllRemaining()

 

Function ReceiveAllRemaining() As Byte()

ReceiveAllRemaining (Int32): array of Byte    (declared in Connection)

 

method ReceiveAllRemaining(bufferSize: Int32): array of Byte

 

Byte[] ReceiveAllRemaining(Int32 bufferSize)

 

Function ReceiveAllRemaining(bufferSize As Int32) As Byte()

Parameters:

  • bufferSize:

ReceiveToStream (Stream)    (declared in Connection)

 

method ReceiveToStream(stream: Stream)

 

void ReceiveToStream(Stream stream)

 

Sub ReceiveToStream(stream As Stream)

Parameters:

  • stream:

ReceiveToStream (Stream, Int64)    (declared in Connection)

 

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)    (declared in Connection)

 

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    (declared in Connection)

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    (declared in Connection)

 

method ResetStatistics

 

void ResetStatistics()

 

Sub ResetStatistics()

Seek    (declared in Connection)

 

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    (declared in Connection)

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    (declared in Connection)

 

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)    (declared in Connection)

 

method SendFromStream(stream: Stream)

 

void SendFromStream(Stream stream)

 

Sub SendFromStream(stream As Stream)

Parameters:

  • stream:

SendFromStream (Stream, Int64)    (declared in Connection)

 

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)    (declared in Connection)

 

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    (declared in Connection)

 

method SetLength(length: Int64)

 

void SetLength(Int64 length)

 

Sub SetLength(length As Int64)

Parameters:

  • length:

SkipBytes    (declared in Connection)

 

method SkipBytes(size: Int32)

 

void SkipBytes(Int32 size)

 

Sub SkipBytes(size As Int32)

Parameters:

  • size:

StartTimeoutTimer  protected    (declared in Connection)

 

method StartTimeoutTimer

 

void StartTimeoutTimer()

 

Sub StartTimeoutTimer()

StopTimeoutTimer  protected    (declared in Connection)

 

method StopTimeoutTimer

 

void StopTimeoutTimer()

 

Sub StopTimeoutTimer()

ToString    (declared in Connection)

 

method ToString: String

 

String ToString()

 

Function ToString() As String

TriggerAsyncDisconnect    (declared in Connection)

 

method TriggerAsyncDisconnect

 

void TriggerAsyncDisconnect()

 

Sub TriggerAsyncDisconnect()

TriggerAsyncHaveIncompleteData  protected    (declared in Connection)

 

method TriggerAsyncHaveIncompleteData

 

void TriggerAsyncHaveIncompleteData()

 

Sub TriggerAsyncHaveIncompleteData()

TriggerOnBytesReceived  protected    (declared in Connection)

 

method TriggerOnBytesReceived(count: Int64)

 

void TriggerOnBytesReceived(Int64 count)

 

Sub TriggerOnBytesReceived(count As Int64)

Parameters:

  • count:

TriggerOnBytesSent  protected    (declared in Connection)

 

method TriggerOnBytesSent(count: Int64)

 

void TriggerOnBytesSent(Int64 count)

 

Sub TriggerOnBytesSent(count As Int64)

Parameters:

  • count:

Write    (declared in Connection)

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)    (declared in Connection)

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)    (declared in Connection)

 

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)    (declared in Connection)

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)    (declared in Connection)

 

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    (declared in Connection)

 

event AsyncDisconnect: EventHandler;

 

delegate EventHandler AsyncDisconnect()

 

Event AsyncDisconnect As EventHandler

AsyncHaveIncompleteData    (declared in Connection)

 

event AsyncHaveIncompleteData: EventHandler;

 

delegate EventHandler AsyncHaveIncompleteData()

 

Event AsyncHaveIncompleteData As EventHandler

OnBytesReceived    (declared in Connection)

 

event OnBytesReceived: EventHandler;

 

delegate EventHandler OnBytesReceived()

 

Event OnBytesReceived As EventHandler

OnBytesSent    (declared in Connection)

 

event OnBytesSent: EventHandler;

 

delegate EventHandler OnBytesSent()

 

Event OnBytesSent As EventHandler