下面是我创建了一个对象并希望将其复制到字节数组的类的代码,以便可以通过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命令是否正确?