C
cp0574
Unregistered / Unconfirmed
GUEST, unregistred user!
接收方收到的是乱码!我的相关代码如下:
type
Pcom=^Tcom;
Tcom=record
Ctrl:byte;
hostname:string;
IP:string;
。。。
end;
发送方发送数据如下:(var acomcom
with ACom do
begin
CTRL:=ASK;
hostname:=selfname;
ip:=selfIP;
。。。
end;
MyStream:=TMemoryStream.Create;
try
MyStream.Write(ACom^,sizeof(ACom^));
CUDP.SendStream(MyStream);
finally
MyStream.Free;
end;
接收方的代码:
MyStream:=TMemoryStream.Create;
CUDP.ReadStream(MyStream);
MyStream.Readbuffer(ACom^,NumberBytes);
with Acom^ do
begin
recctrl:=CTRL;
recname:=hostname;
recIP:=ip;
。。。
end;
这里收到的ACOM全为乱码!望大家告我问题出哪?????
type
Pcom=^Tcom;
Tcom=record
Ctrl:byte;
hostname:string;
IP:string;
。。。
end;
发送方发送数据如下:(var acomcom
with ACom do
begin
CTRL:=ASK;
hostname:=selfname;
ip:=selfIP;
。。。
end;
MyStream:=TMemoryStream.Create;
try
MyStream.Write(ACom^,sizeof(ACom^));
CUDP.SendStream(MyStream);
finally
MyStream.Free;
end;
接收方的代码:
MyStream:=TMemoryStream.Create;
CUDP.ReadStream(MyStream);
MyStream.Readbuffer(ACom^,NumberBytes);
with Acom^ do
begin
recctrl:=CTRL;
recname:=hostname;
recIP:=ip;
。。。
end;
这里收到的ACOM全为乱码!望大家告我问题出哪?????