Home > Back-end >  Help Daniel, passing all to see
Help Daniel, passing all to see

Time:10-11



Dear Daniel, I now write a receiving server sends data, using IIdTCPClient, has test can normal connection, but the received data is garbled, make half a day did not understand, manually labeled as receiving code below:

IdTCPClient1 - & gt; IOHandler - & gt; CheckForDataOnSource (0);
if(! IdTCPClient1 - & gt; IOHandler - & gt; InputBufferIsEmpty ())
{
TMemoryStream * ms=new TMemoryStream;
Int nByteCount=IdTCPClient1 - & gt; IOHandler - & gt; The InputBuffer - & gt; The Size;
Memo1 - & gt; Lines - & gt; Add (IntToStr (nByteCount));
IdTCPClient1 - & gt; IOHandler - & gt; ReadStream (ms, nByteCount, False);
.
.
}
Every time only nByteCount shows 252 in a memo, receiving the following are garbled, please prawns are what possible reason


CodePudding user response:

Look at the coding way,

CodePudding user response:

Under a debugging tool online, received in hexadecimal display is normal, with text display is garbled, that I how also can receive hexadecimal

CodePudding user response:

To receive part of the code can't see the problem
Before the show, you'd better put TMemoryStream * ms
Reset to start
Ms - & gt; The Position=0;
  • Related