Indy9 Code
void__fastcall TfrmMain::ServerConnect (TIdPeerThread*AThread)
{
BKUK_PACKET Pkt;
-----------------------------------------------------------
AThread->Connection->ReadBuffer(BYTE*)&Pkt,sizeof(BKUK_PACKET));
-----------------------------------------------------------
}
I can't find a feature called ReadBuffer in Indy10, but is there a similar feature?
The code seems to be moving the received BKUK_PACKET data to the memory location of the Pkt pointer.
BKUK_PACKET is about 1200 bytes of data like this.
typedef structure_BKUK_PACKET_
{
BYTE head [4];
WORD PayLoad;
WORD Length;
BYTE Data [1200];
WORD VER;
BYTE tail [2];
}BKUK_PACKET;
When I used Indy before, I received data, etc.
AnsiString rcvdStr;
rcvdStr = AContext->Connection->IOHandler->ReadLn (IndyTextEncoding (932));
I have received data like this before, but can I still use ReadLn() in this case?
(Movement)
Context->Connection->IOHandler->ReadBytes(BYTE*)&Pkt,sizeof(BKUK_PACKET))
I found a feature called ReadBytes and tried to program it as above, but I got the following error:
[bcc32c Error] Main.cpp(530): non-const value reference to type 'Idglobal::TIdBytes' (aka 'DynamicArray') cannot bind to a temporary of type 'BYTE*' (aka 'unsigned char*')
IdIOHandler.hpp(235): passing argument to parameter 'VBuffer'here
I get this kind of error, is there any way to deal with it?
delphi
Thank you for your help.
I am writing to let you know that I have solved the problem on this site.
Answer: Is there an indy 9 function called ReadBuffer in Indy 10?https://stackoverflow.com/a/59126191/12281072?stw=2
© 2024 OneMinuteCode. All rights reserved.