How can I use tidudpserver to receive hexadecimal data conversion? Delphi/Windows SDK/API
Http://www.delphi2007.net/DelphiNetwork/html/delphi_20061213114706133.html
I use tidudpserver to receive data from machines. Because the received data is in hexadecimal format, I cannot judge. How can I convert it to Char or string type?
On
Procedure udpserverudpread (Sender: tobject; aData: tstream;
Abinding: tidsockethandle );
The tstream type cannot be converted in the event. What should I use? Tstringsteam, tmemorystream or something. Please take a look. Thank you.
Procedure tform1.idudpserver1udpread (Sender: tobject; aData: tstream;
Abinding: tidsockethandle );
VaR
A: array of char;
S: string;
Begin
Setlength (A, aData. size );
AData. readbuffer (A [0], aData. size );
S: = pchar (@ A [0]);
End;
Tmemorystream is a memory stream. tstringstream is a character stream.
One is saved to the memory stream, and the other is saved to the character stream ~~