unit Chat_unit;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, Sockets;
type
TForm2 =
class(TForm)
MemoRecive: TMemo;
EdNick: TEdit;
EdIp: TEdit;
EdPort: TEdit;
BtnSend: TButton;
Label1: TLabel;
Label2: TLabel;
Label3: TLabel;
MemoSend: TMemo;
BtnConnect: TButton;
ClientSocket: TTcpClient;
procedure BtnConnectClick(Sender: TObject);
procedure ClientSocketReceive(Sender: TObject; Buf: PAnsiChar;
var DataLen: Integer);
procedure BtnSendClick(Sender: TObject);
private
{ Private-Deklarationen }
public
{ Public-Deklarationen }
end;
var
Form2: TForm2;
EdPort :
string ;
implementation
{$R *.dfm}
procedure TForm2.BtnConnectClick(Sender: TObject);
begin
begin
ClientSocket.RemoteHost:=EdIP.Text;
//Die IP wird festgelegt
ClientSocket.RemotePort:= EdPort.text;
//Der Port wird festgelegt
ClientSocket.Open;
//Verbindung zum Server wird hergestellt
end;
end;
procedure TForm2.BtnSendClick(Sender: TObject);
begin
ClientSocket.Sendln(BTNSEND.caption);
end;
procedure TForm2.ClientSocketReceive(Sender: TObject; Buf: PAnsiChar;
var DataLen: Integer);
begin;
end;
var
msg:
String;
clientsocket : ttcpclient;
memorecive : Tmemo;
begin;
msg := Clientsocket.Receiveln(MsG);
memorecive.Lines.Add(MSG);
end.