Thank you for your help.
I am converting an older version of Delphi to XE5 and I am getting stuck with the Indy compnent. Need to use IdUDPClient.ReceiveBuffer
Here is my code:
while not Terminated do
begin
try
lenUDP:= IdUDPClient.ReceiveBuffer(myBuf, buffLength, -1 );
if lenUDP<> 0 then
Synchronize(ReceivedLine);
except
Terminate;
end;
end;
where, myBuf = packed array [0 .. buffLength -1] of char;
All help is greatly appreciated.
Thank you,
Mike
As I told you in comments to your previous question:
For example:
Since your original buffer was an array of
Char
, and your processing function is namedReceivedLine()
, I am assuming your data is textual in nature. If that is true, you can useBytesToString()
or(T|I)IdTextEncoding.GetString()
to convert aTIdBytes
to aString
, if that is whatReceivedLine()
usesmyBuf
for, eg:You can use any charset encoding that Indy supports, either via the various
en...()
,Indy...Encoding()
, orIndyTextEncoding...()
functions in theIdGlobal
unit, or theCharsetToEncoding()
function in theIdGlobalProtocols
unit.UPDATE: since your buffer is part of a record with a union in it, you will have to use a local
TIdBytes
variable instead: