TROBaseSuperConnection

Overview

This is an abstract class used to represent a TCP connections internally in Super TCP Channel classes, both client and server. This class is pure abstract, concrete implementations depend on communication level libraries: * Indy - TROIndySuperConnection * Synapse - TROSynapseSuperConnection The connection class is closely related to the superchannel worker class TROBaseSuperChannelWorker.
Users shoud never use neither this class directly nor it's descendants.

Location

 

Client_Connect  virtual abstract

Called on the client side only to establish initial connection to the server.

procedure Client_Connect(const aHost: string; const aPort: integer)

Parameters:

  • aHost: The host name or IP address of the server.
  • aPort: The port to connect to.

Disconnect  virtual abstract

Called to disconnect the current connection.

procedure Disconnect

isConnected  virtual abstract

Returns the connected state of the connection.

function isConnected: Boolean

isTimeoutError  virtual abstract

Returns true in case the last connection error was caused by timeout, false for all other errors. As a rule, errors other than timeouts require the connection to be reestablished from the scratch.

function isTimeoutError: Boolean

PingFrequency  protected

Provides read-only access to TROBaseSuperChannelWorker.PingFrequency property.

property PingFrequency: integer read write

PingTimeOut  protected

Provides read-only access to TROBaseSuperChannelWorker.PingTimeOut property.

property PingTimeOut: integer read write

ReadBuffer  virtual abstract

Reads a portion of data from the connection into the buffer.

function ReadBuffer(var Data: ; Len: Integer): integer

Parameters:

  • Data: The buffer to read the data into.
  • Len: Expected length of the data.

ReadByte  virtual abstract

Reads a byte from the connection and returns it as a result.

function ReadByte: Byte

ReadInteger  virtual abstract

Reads a 32 bits integer from the connection and returns it as a result.

function ReadInteger: integer

ReadString  virtual abstract

Reads a string of the specified length from the connection and returns it as a result.

function ReadString(const aLen: integer): string

Parameters:

  • aLen: The length of the string in bytes.

SetNagle  virtual abstract

Enables or disables Nagle's algorithm usage according to property value introduced by the concrete channel implementation.

procedure SetNagle

TryReadByte  virtual abstract

Tries to read a byte from the connection. Returns true if the byte was read successfully.

function TryReadByte(var aValue: Byte): boolean

Parameters:

  • aValue: The value of the byte is returned via this parameter if read successfully.

WriteBuffer  virtual abstract

Writes a portion of data from the buffer to the connection.

procedure WriteBuffer(const Data: ; Len: Integer)

Parameters:

  • Data: The buffer containing data to write.
  • Len: The length of the data.

WriteByte  virtual abstract

Writes a byte to the connection.

procedure WriteByte(const aValue: Byte)

Parameters:

  • aValue: The byte to write.

WriteInteger  virtual abstract

Writes a 32 bits integer to the connection.

procedure WriteInteger(const aValue: integer)

Parameters:

  • aValue: The value to write.

WriteString  virtual abstract

Writes a string to the connection.

procedure WriteString(const AStr: string)

Parameters:

  • AStr: The string to write.

 

PingFrequency  protected

Provides read-only access to TROBaseSuperChannelWorker.PingFrequency property.

property PingFrequency: integer read write

PingTimeOut  protected

Provides read-only access to TROBaseSuperChannelWorker.PingTimeOut property.

property PingTimeOut: integer read write

 

Client_Connect  virtual abstract

Called on the client side only to establish initial connection to the server.

procedure Client_Connect(const aHost: string; const aPort: integer)

Parameters:

  • aHost: The host name or IP address of the server.
  • aPort: The port to connect to.

Disconnect  virtual abstract

Called to disconnect the current connection.

procedure Disconnect

isConnected  virtual abstract

Returns the connected state of the connection.

function isConnected: Boolean

isTimeoutError  virtual abstract

Returns true in case the last connection error was caused by timeout, false for all other errors. As a rule, errors other than timeouts require the connection to be reestablished from the scratch.

function isTimeoutError: Boolean

ReadBuffer  virtual abstract

Reads a portion of data from the connection into the buffer.

function ReadBuffer(var Data: ; Len: Integer): integer

Parameters:

  • Data: The buffer to read the data into.
  • Len: Expected length of the data.

ReadByte  virtual abstract

Reads a byte from the connection and returns it as a result.

function ReadByte: Byte

ReadInteger  virtual abstract

Reads a 32 bits integer from the connection and returns it as a result.

function ReadInteger: integer

ReadString  virtual abstract

Reads a string of the specified length from the connection and returns it as a result.

function ReadString(const aLen: integer): string

Parameters:

  • aLen: The length of the string in bytes.

SetNagle  virtual abstract

Enables or disables Nagle's algorithm usage according to property value introduced by the concrete channel implementation.

procedure SetNagle

TryReadByte  virtual abstract

Tries to read a byte from the connection. Returns true if the byte was read successfully.

function TryReadByte(var aValue: Byte): boolean

Parameters:

  • aValue: The value of the byte is returned via this parameter if read successfully.

WriteBuffer  virtual abstract

Writes a portion of data from the buffer to the connection.

procedure WriteBuffer(const Data: ; Len: Integer)

Parameters:

  • Data: The buffer containing data to write.
  • Len: The length of the data.

WriteByte  virtual abstract

Writes a byte to the connection.

procedure WriteByte(const aValue: Byte)

Parameters:

  • aValue: The byte to write.

WriteInteger  virtual abstract

Writes a 32 bits integer to the connection.

procedure WriteInteger(const aValue: integer)

Parameters:

  • aValue: The value to write.

WriteString  virtual abstract

Writes a string to the connection.

procedure WriteString(const AStr: string)

Parameters:

  • AStr: The string to write.

Descendants