下面是一个类的代码,我创建了一个对象并希望将其复制到字节数组中,以便可以通过 udp 网络发送它。
unit client_info;
interface
uses
sysutils,windows;
type
Tclient = class
public
Fexternal_ip: string;
Fexternal_port:word;
Finternal_ip: string;
Finternal_port:word;
Fusername:string;
constructor create(Ae_ip:string;Ae_port:word;Ai_ip:string;Ai_port:word;Ausername:string);
end;
implementation
constructor Tclient.create(Ae_ip:string;Ae_port:word;Ai_ip:string;Ai_port:word;Ausername:string);
begin
Fexternal_ip:=Ae_ip;
Fexternal_port:=Ae_port;
Finternal_ip:=Ai_ip;
Finternal_port:=Ai_port;
Fusername:=Ausername;
end;
end.
implementation
user:=tclient.create(ex_ip,ex_port,s,0,''); // client profile
move(user,buffer[0],length(buffer));
使用 move 命令是否正确?