C
chimney
Unregistered / Unconfirmed
GUEST, unregistred user!
发送:
procedure TF_Control.Button2Click(Sender: TObject);
type
ra=record
a:integer;
b:array[0..1023] of Char;
end;
rb=record
a:Integer;
b:Integer;
c:Integer;
end;
ac=array of rb;
var
a:ac;
i:Integer;
r:ra;
begin
SetLength(a,10);
for i:=0 to 9 do
with a do
begin
a:=0;
b:=1;
c:=2;
end;
Move(a,r.b,sizeof(a)*Length(a));
ServerSocket1.Socket.Connections[0].SendBuf(r,SizeOf(r));
end;
接收:
procedure TForm1.ClientSocket1Read(Sender: TObject;
Socket: TCustomWinSocket);
type
ra=record
a:integer;
b:array[0..1023] of Char;
end;
rb=record
a:Integer;
b:Integer;
c:Integer;
end;
ac=array of rb;
var
a:ac;
r:ra;
begin
SetLength(a,10);
Socket.ReceiveBuf(r,sizeof(r));
move(r.b,a,sizeof(a)*Length(a));//这一步出错了。
end;
procedure TF_Control.Button2Click(Sender: TObject);
type
ra=record
a:integer;
b:array[0..1023] of Char;
end;
rb=record
a:Integer;
b:Integer;
c:Integer;
end;
ac=array of rb;
var
a:ac;
i:Integer;
r:ra;
begin
SetLength(a,10);
for i:=0 to 9 do
with a do
begin
a:=0;
b:=1;
c:=2;
end;
Move(a,r.b,sizeof(a)*Length(a));
ServerSocket1.Socket.Connections[0].SendBuf(r,SizeOf(r));
end;
接收:
procedure TForm1.ClientSocket1Read(Sender: TObject;
Socket: TCustomWinSocket);
type
ra=record
a:integer;
b:array[0..1023] of Char;
end;
rb=record
a:Integer;
b:Integer;
c:Integer;
end;
ac=array of rb;
var
a:ac;
r:ra;
begin
SetLength(a,10);
Socket.ReceiveBuf(r,sizeof(r));
move(r.b,a,sizeof(a)*Length(a));//这一步出错了。
end;