This code is written by Borland Cpp Builder6 in Indy9.
(该代码由Indy9中的Borland Cpp Builder6编写。)
void __fastcall TfrmMain::ServerConnect(TIdPeerThread *AThread)
{
BKUK_PACKET Pkt;
----------(中略)---------------------------------------
AThread->Connection->ReadBuffer((BYTE *)&Pkt,sizeof(BKUK_PACKET));
----------(中略)---------------------------------------
}
The function named ReadBuffer is not found in Indy10.
(在Indy10中找不到名为ReadBuffer的函数。)
Is there an equivalent function? (有等效功能吗?)
BKUK_PACKET is a structure of about 1200 bytes.
(BKUK_PACKET是大约1200个字节的结构。)
typedef struct _BKUK_PACKET_
{
BYTE head[4];
WORD PayLoad;
WORD Length;
BYTE Data[1200];
WORD Ver;
BYTE tail[2];
}BKUK_PACKET;
I found ReadBytes when I was looking at the instruction manual for Indy10.
(我在查看Indy10的使用手册时发现了ReadBytes。)
Context->Connection->IOHandler->ReadBytes((BYTE *)&Pkt,sizeof(BKUK_PACKET))
When I tried to program as above, I got the following error:
(当我尝试如上所述编程时,出现以下错误:)
[bcc32c error] Main.cpp(530): non-const lvalue 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
([bcc32c错误] Main.cpp(530):对类型'Idglobal :: TIdBytes'(又名'DynamicArray')的非常量左值引用无法绑定到类型为'BYTE *'(又名'unsigned char *')的临时IdIOHandler .hpp(235):在此处将参数传递给参数“ VBuffer”)
Please tell me how to fix it.
(请告诉我如何解决。)
Thanks (谢谢)
ask by nordsynth translate from so 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…