Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win


Capturing Data from ICS TWSocket Into a File?

Posted on 2004-04-13
Medium Priority
Last Modified: 2010-04-05
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: String;

  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?
Question by:coole
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3

Expert Comment

ID: 10821338
Instead of concatenating SocketData to a single string (FCapturedData), why not add it as a new line to a hidden TMemo or TStringList which you occasionally write out to a disk file?

Author Comment

ID: 10829514
Because i would like the data to be in it's original format so that i can playback the file with hyper terminal. Memo or StringList will store in a delimited format right unless i concatenate them into a string again?

Accepted Solution

sftweng earned 500 total points
ID: 10829572
I suspect a single string is too small to hold all of your data, so you're going to have to use more than one; a TStringList seems to me to be the best alternative. For playback purposes, you can just ignore the string boundaries.

Expert Comment

ID: 13190262
I believe I earned these points

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

A lot of questions regard threads in Delphi.   One of the more specific questions is how to show progress of the thread.   Updating a progressbar from inside a thread is a mistake. A solution to this would be to send a synchronized message to the…
The uses clause is one of those things that just tends to grow and grow. Most of the time this is in the main form, as it's from this form that all others are called. If you have a big application (including many forms), the uses clause in the in…
How to fix incompatible JVM issue while installing Eclipse While installing Eclipse in windows, got one error like above and unable to proceed with the installation. This video describes how to successfully install Eclipse. How to solve incompa…
In a question here at Experts Exchange (https://www.experts-exchange.com/questions/29062564/Adobe-acrobat-reader-DC.html), a member asked how to create a signature in Adobe Acrobat Reader DC (the free Reader product, not the paid, full Acrobat produ…
Suggested Courses

604 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question