unit Unit1;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
StdCtrls, ScktComp;
type
TForm1 = class(TForm)
cs: TClientSocket;
ss: TServerSocket;
Button1: TButton;
Memo1: TMemo;
Button2: TButton;
procedure Button1Click(Sender: TObject);
procedure ssClientRead(Sender: TObject; Socket: TCustomWinSocket);
procedure Button2Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
buf:array[0..100,0..5] of string[255];
pbuf
char;
alllen:integer;
end;
var
Form1: TForm1;
implementation
{$R *.DFM}
procedure TForm1.Button1Click(Sender: TObject);
var
p:array[0..100,0..5] of string[255];
i,j:integer;
begin
pbuf:=@buf;
for i:=0 to 100 do
for j:=0 to 5 do
begin
p[i,j]:=inttostr(i)+':'+inttostr(j);
end;
cs.Socket.SendBuf(p,sizeof(p));
end;
procedure TForm1.ssClientRead(Sender: TObject; Socket: TCustomWinSocket);
begin
socket.ReceiveBuf(pbuf^,socket.ReceiveLength );
inc(pbuf,socket.ReceiveLength);
end;
procedure TForm1.Button2Click(Sender: TObject);
var
i,j:integer;
begin
for i:=0 to 100 do
for j:=0 to 5 do
begin
memo1.Lines.Add(buf[i,j]);
end;
end;
end.