while i<Length(DestStr) do
begin
showmessage('$'+Copy(DestStr,i,2));
SendedStr:=SendedStr+Copy(DestStr,i,2)+' ';
ToSendStr:=ToSendStr+Char(StrToInt('$'+Copy(DestStr,i,2));//strtoint('$'+Copy(DestStr,i,2))是把可视的十六进制的转换成十进制char是把十进制的数转换成计算机中的字符 showmessage(tosendstr);//在尝试解决,但到主为何ToSendStr这个为空有人知道吗
i:=i+2;
end;
begin
showmessage('$'+Copy(DestStr,i,2));
SendedStr:=SendedStr+Copy(DestStr,i,2)+' ';
ToSendStr:=ToSendStr+Char(StrToInt('$'+Copy(DestStr,i,2));//strtoint('$'+Copy(DestStr,i,2))是把可视的十六进制的转换成十进制char是把十进制的数转换成计算机中的字符 showmessage(tosendstr);//在尝试解决,但到主为何ToSendStr这个为空有人知道吗
i:=i+2;
end;
看楼主现象,数据变长了,应该用的 是默认宽字符版 的 Delphi 。
idudpclient1 肯定有别的发送函数可以调用的啊,我这 idudpclient1.SendBuffer 是传 TIdBytes 类型的参数,你将数据定义到 TIdBytes 再发试试。实在不行,直接winsock2-API的sendto ,肯定可以。
RxBuf:TIdBytes;
begin
RxBuf := Idglobal.RawToBytes(DM.uUDPBroadcastingBuf, SizeOf (DM.uUDPBroadcastingBuf));
//idpclnt.Send('192.168.1.255',7890,'oushengfen'); {测试数据}
idpclnt.SendBuffer('50.255.255.255',8888,RxBuf);