

Indy9で書かれたプログラム

[code]

    void __fastcall TfrmMain::ServerConnect(TIdPeerThread *AThread)
    {
    ----------(中略)---------------------------------------
        TIdTCPServerConnection * con = AThread->Connection;
    ----------(中略)---------------------------------------
           int iExpectedLen = 0, iStackBufSize=0;
    ----------(中略)---------------------------------------
           iStackBufSize = con->ReadFromStack(true,5000,true);
    ----------(中略)---------------------------------------
    }
    
[/code]

このプログラムをIndy10のプログラムに移行したいのですが、ReadFromStackというのをIndy10の取説でキーワード検索しても出てこないのですが、同等の機能というものはありますでしょうか？


CC BY-SA 4.0
2019-11-30T08:09:33.180
60962
2019-11-30T09:23:18.993
35993
question
delphi
TIdTCPConnection.ReadFromStackと同等の機能はIndy10にはありますか？


こんな記事があるので：  
[Upgrade Indy9 to Indy10](https://stackoverflow.com/q/2027579/9014308)  
質問

> I want to upgrade my application from Indy 9 to 10 with Delphi 2007. There
> is a lot of issues in this, I have read the indy doc about changes but I
> still need advise. This won't compile as ReadString is not found.
[code]

>     vCmdHead := FTCPClient.ReadString(16);
>  
[/code]

>
> where FTCPClient is of type TIdTCPClient. vCmdHead is a structure that
> contains a command as a string. What method could I use instead ?

回答

>
[code]

>       {$IFDEF INDY10}
>       ALine := IdTCPClient.IOHandler.ReadString(16);
>       {$ELSE}
>       Aline := IdTCPClient.ReadString(16);
>       {$ENDIF}
>  
[/code]

>
> Something like this

他にこんな記事も：  
[Upgrading Delphi 7 Indy 9 app to Indy 10
(II)](https://stackoverflow.com/q/40195248/9014308)

* * *

それの類推でこれあたりが該当しそうです。  
[TIdIOHandlerStack
Class](http://ww2.indyproject.org/docsite/html/frames.html?frmname=topic&frmfile=%21%21MEMBEROVERVIEW_TIdIOHandlerStack.html)  
[TIdIOHandlerStack
Members](http://ww2.indyproject.org/docsite/html/frames.html?frmname=topic&frmfile=%21%21MEMBEROVERVIEW_TIdIOHandlerStack.html)  
[TIdIOHandler.ReadBytes
Method](http://ww2.indyproject.org/docsite/html/frames.html?frmname=topic&frmfile=index.html)

[TIdTCPConnection
Class](http://ww2.indyproject.org/docsite/html/frames.html?frmname=topic&frmfile=TIdTCPConnection.html)  
[TIdTCPConnection
Members](http://ww2.indyproject.org/docsite/html/frames.html?frmname=topic&frmfile=TIdTCPConnection.html)  
[TIdTCPConnection.CreateIOHandler
Method](http://ww2.indyproject.org/docsite/html/frames.html?frmname=topic&frmfile=TIdTCPConnection_CreateIOHandler@TIdIOHandlerClass.html)  
[TIdTCPConnection.IOHandler
Property](http://ww2.indyproject.org/docsite/html/frames.html?frmname=topic&frmfile=TIdTCPConnection_IOHandler.html)  
[TIdTCPConnection.ManagedIOHandler
Property](http://ww2.indyproject.org/docsite/html/frames.html?frmname=topic&frmfile=TIdTCPConnection_ManagedIOHandler.html)

実際に関係するのか、どのように使えば良いか等は調べてみてください。

Indy9の該当メソッドの記事はこちら。  
[TIdTCPConnection.ReadFromStack](http://www.e-iter.net/Knowledge/Indy9/007828.html#0029)


CC BY-SA 4.0
2019-11-30T09:23:18.993
60963
2019-11-30T09:23:18.993
26370
60962
answer