Realtime streams and FTP server

Giganews Newsgroups
Subject: Realtime streams and FTP server
Posted by:  Khash Sajadi (kha…
Date: Tue, 19 Jul 2005

I have a problem with Indy FTP Server.

I have to use a real time stream as the TStream object used by the server to
retrieve the data for the data channel.

The problem is WriteToStream method of TIdFTPServer.DoDataChannelOperation
calls the .Size of the stream to pass to
AContext.FDataChannel.FDataChannel.IOHandler.Write as a parameter.

In IOHandler it is also mentioned (as a comment in TIdIOHandler.Write) that
we use .Size and it should return a value although it might be a real time
stream. I asked this question before on this newsgroup and Remy Lebeau
suggested that I set the size to the maximum possible value and the upon the
end of the stream set to position equal to the size.

The problem is it seems the  "while ASize > 0 do begin" line in
TIdIOHandler.Write expects to have ASize number of bytes and keeps calling
AStream.ReadBytes. And in the case of AStream.ReadBytes returning 0 number
of bytes an EIdNoDataToRead is thrown.

What I need to know now is, is there a way of using real time streams in FTP
server or somehow telling the server to stop asking for more data from the
stream without breaking anything in the server?

Thank you,