Class TTWSChatForm (unit twschat1)

Inherits from

TForm

Any port would do the job...

Constructors



Functions

procedure CliWSocketDataAvailable(Sender: TObject; Error: Word);

* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *} { This event is triggered when data has been received from the client.

procedure CliWSocketDnsLookupDone(Sender: TObject; Error: Word);

* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *} { This event handler is triggered when the DNS lookup process is finished } { successfully or not.

procedure CliWSocketSessionClosed(Sender: TObject; Error: Word);

* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *} { This event is triggered when the client connection is closed, either } { by the client himself or by the local user pushing the disconnect button

procedure CliWSocketSessionConnected(Sender: TObject; Error: Word);

* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *} { This event handler is triggered when the connection is established with } { the server.

procedure ConnectButtonClick(Sender: TObject);

* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *} { The user has clicked on the 'connect' button.

procedure DisconnectButtonClick(Sender: TObject);

* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *} { The user clicked on the disconnect button.

procedure FormShow(Sender: TObject);

* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *

procedure RunningRadioButtonClick(Sender: TObject);

* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *

procedure SendButtonClick(Sender: TObject);

* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *} { The user has clicked on the send button.

procedure SrvWSocketSessionAvailable(Sender: TObject; Error: Word);

* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *} { This event is triggered when we - as a server - have received a client } { connection request.

procedure StoppedRadioButtonClick(Sender: TObject);

* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *

procedure StartServer;

* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *

Properties

Events

Variables

CliWSocket : TWSocket;


ConnectButton : TButton;


DisconnectButton : TButton;


DisplayMemo : TMemo;


Label1 : TLabel;


MessageEdit : TEdit;


Panel1 : TPanel;


Panel2 : TPanel;


RunningRadioButton : TRadioButton;


SendButton : TButton;


ServerEdit : TEdit;


SrvWSocket : TWSocket;


StoppedRadioButton : TRadioButton;


TmpWSocket : TWSocket;


Initialized : Boolean;

Déclarations privées

RcvBuf : array [0..1023] of char;


RcvLen : integer;



Constructors


Functions


procedure CliWSocketDataAvailable(Sender: TObject; Error: Word);

* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *} { This event is triggered when data has been received from the client. } { A little bit of work here because the data can comes fragmented or in big } { chunks with several client lines. So we assemble the data received in a } { buffer and check the buffer for complete lines (there can be no complete } { line, exactly one complete line, several complete lines and may be an } { incomplete line at the end.


procedure CliWSocketDnsLookupDone(Sender: TObject; Error: Word);

* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *} { This event handler is triggered when the DNS lookup process is finished } { successfully or not. If DNS lookud failed, display a message. } { If DNS lookup successfull, ask TWSocket to connect the server.


procedure CliWSocketSessionClosed(Sender: TObject; Error: Word);

* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *} { This event is triggered when the client connection is closed, either } { by the client himself or by the local user pushing the disconnect button


procedure CliWSocketSessionConnected(Sender: TObject; Error: Word);

* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *} { This event handler is triggered when the connection is established with } { the server. Enable the send button and the message edit box.


procedure ConnectButtonClick(Sender: TObject);

* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *} { The user has clicked on the 'connect' button. We will not connect here, } { but start the DNSLookup. We will receive a event when it is complete. } { The connection will be made at that later time.


procedure DisconnectButtonClick(Sender: TObject);

* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *} { The user clicked on the disconnect button.


procedure FormShow(Sender: TObject);

* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *


procedure RunningRadioButtonClick(Sender: TObject);

* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *


procedure SendButtonClick(Sender: TObject);

* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *} { The user has clicked on the send button. Just send the data in the edit } { box and a CRLF pair to make a complete line.


procedure SrvWSocketSessionAvailable(Sender: TObject; Error: Word);

* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *} { This event is triggered when we - as a server - have received a client } { connection request. We must accept the connection. Two cases: we are } { already busy with another client, or this is the first client connecting.


procedure StoppedRadioButtonClick(Sender: TObject);

* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *


procedure StartServer;

* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *


Properties


Events


Variables


CliWSocket : TWSocket;


ConnectButton : TButton;


DisconnectButton : TButton;


DisplayMemo : TMemo;


Label1 : TLabel;


MessageEdit : TEdit;


Panel1 : TPanel;


Panel2 : TPanel;


RunningRadioButton : TRadioButton;


SendButton : TButton;


ServerEdit : TEdit;


SrvWSocket : TWSocket;


StoppedRadioButton : TRadioButton;


TmpWSocket : TWSocket;


Initialized : Boolean;

Déclarations privées


RcvBuf : array [0..1023] of char;


RcvLen : integer;