I'm using Delphi XE8 for developing mobile apps and Desktop application. In mobile application, I'm using TIDtcpClient component and in Desktop application application, I'm using TServerSocket.
Server Desktop application contains TList which contains some 1500 records. For getting these values in Client Mobile application, I'm using the following method.
- First the download request is send from Client mobile app to Server application.
- Next it retrieves 10 records and sends back to Client mobile application. After this it updates the values in Client List and then again it sends back the request to server app.
- Till the record count reaches, this process continues.
The problem is when I'm following this method it takes almost 2 minutes of time and I'm getting all the data properly. So I have decided to use the file stream method. Below I have mentioned the sample code:
Server Side app:
//first saved the List into FileStream & it is working as I have reloaded and checked
//So again I'm loading the saved file, The file Size is near to 400KB
FileStream := TFileStream.Create('D:\ListDet.dat', mtfmOpenRead);
Socket.SendStream(FileStream);
Client Side mobile app:
var
FileS: TFileStread;
i: Size;
begin
//Inside the thread
TiDTcpClient.IOHandler.ReadStream(FileS, i);
end;
And When I'm using the above method, I'm getting the exception and I'm can not retrieve data.
Please provide me any solution to retrieve the data faster from Server to Client.
I'm getting the exception
... what is the actual exception class and message? – mjn