TScReceiveDataFromSourceEvent = function (Sender: TObject; var Data; Offset, Count: integer): integer of object;
TScSendDataToTargetEvent = procedure (Sender: TObject; const Data; Offset, Count: integer) of object;
procedure Init(Connection: TScTCPConnection); overload;
procedure Init(OnConnect: TNotifyEvent; OnReceiveDataFromSource: TScReceiveDataFromSourceEvent; OnSendDataToTarget: TScSendDataToTargetEvent); overload;
Initializes a connection by passing the input and output sources for the connection.
You can get data either through a socket-based connection (TScTCPConnection) or using events for reading and sending data. Init is an overloaded method and allows getting data both ways.
Init should be called before connecting to the client.
|•||Connection - an initialized TScTCPConnection that enables the server to connect to the client directly through a socket connection. The server calls the methods of the connection object to send and receive data.|
|•||OnConnect - the event hanlder that is called when a connection to the client has been established.|
|•||OnReceiveDataFromSource - the event hander that is called when the server needs to get data from the client. The event accepts the pointer to the data and its size.|
|•||OnSendDataToTarget - the event handler that is called when the server needs to send data to the client. The event accepts the pointer to the data and its size.|