塬
塬上独狼
Unregistered / Unconfirmed
GUEST, unregistred user!
unit cs;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, OleCtrls,winsock, MSWinsockLib_TLB;
type
TForm1 = class(TForm)
Winsock1: TWinsock;
Label1: TLabel;
Label2: TLabel;
memo1: TMemo;
memo2: TMemo;
procedure FormCreate(Sender: TObject);
procedure memo1Change(Sender: TObject);
procedure Winsock1DataArrival(ASender: TObject; bytesTotal: Integer);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.FormCreate(Sender: TObject);
begin
winsock1.LocalPort :=1998;
winsock1.RemoteHost :='11.12.18.5';
winsock1.RemotePort:=1998;
end;
procedure TForm1.memo1Change(Sender: TObject);
begin
winsock1.SendData(memo1.Text );
end;
procedure TForm1.Winsock1DataArrival(ASender: TObject;
bytesTotal: Integer);
var
lrlevariant;
begin
winsock1.GetData(lr) ;
memo2.Text :=lr;
end;
end.
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, OleCtrls,winsock, MSWinsockLib_TLB;
type
TForm1 = class(TForm)
Winsock1: TWinsock;
Label1: TLabel;
Label2: TLabel;
memo1: TMemo;
memo2: TMemo;
procedure FormCreate(Sender: TObject);
procedure memo1Change(Sender: TObject);
procedure Winsock1DataArrival(ASender: TObject; bytesTotal: Integer);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.FormCreate(Sender: TObject);
begin
winsock1.LocalPort :=1998;
winsock1.RemoteHost :='11.12.18.5';
winsock1.RemotePort:=1998;
end;
procedure TForm1.memo1Change(Sender: TObject);
begin
winsock1.SendData(memo1.Text );
end;
procedure TForm1.Winsock1DataArrival(ASender: TObject;
bytesTotal: Integer);
var
lrlevariant;
begin
winsock1.GetData(lr) ;
memo2.Text :=lr;
end;
end.