Currently i do like this and it gives me an out of memory exception after like few hours. It was supposed to capture a day's data and then save it into a file.
procedure TfmMain.MySocketDataAvailable(Sender: TObject; Error: Word);
SocketData := MySocket.ReceiveStr;
// process SocketData here, code's been taken out
FCapturedData := FCapturedData + SocketData;
on E: Exception do
lbException.Caption := 'Exception on capturing data: ' + E.Message;
Maybe i should save the captured string into a file and then append like every hour or after the string size reach a predefine limit. But i think this will slow down the program as the captured string need to be appended to file for several times or more?
Any better solution?