Search found 263 matches

by mark_c
Thu Feb 27, 2020 5:13 am
Forum: Technical
Topic: OnTimer event not work
Replies: 20
Views: 34659

Re: OnTimer event not work

thanks Remy,
I didn't understand this part

Code: Select all

asd->Tag = 0;
then I saw that if you don't use it, the timer continues indefinitely. So it is used to count the number of timer activations and when you have reached the desired number of activations, stop the thread; very interesting.
by mark_c
Wed Feb 26, 2020 7:23 am
Forum: Technical
Topic: OnTimer event not work
Replies: 20
Views: 34659

Re: OnTimer event not work

it is possible that the solution is simply adding Application-> ProcessMessages (); void __fastcall TMyThread::Execute() { TTimer *asd = new TTimer(NULL); asd->Interval = 500; asd->OnTimer = &MyTimer; asd->Enabled = true; msg = myip(StrToInt(myadr)); Synchronize(&MyMemo1); Sleep(1000); Application->...
by mark_c
Wed Feb 26, 2020 2:48 am
Forum: Technical
Topic: OnTimer event not work
Replies: 20
Views: 34659

OnTimer event not work

I can't activate the OnTimer event but I don't see any problems, are there any? //--------------------------------------------------------------------------- #include <vcl.h> #pragma hdrstop #include "Unit1.h" class TMyThread : public TThread { private: void __fastcall MyTimer(TObject *Sender); prot...
by mark_c
Mon Feb 10, 2020 5:44 am
Forum: Technical
Topic: custom socket set OnError event
Replies: 22
Views: 41119

Re: custom socket set OnError event

sorry Remy, but you already answered me here
viewtopic.php?f=10&t=3262
by mark_c
Sat Feb 08, 2020 1:56 am
Forum: Technical
Topic: Multi thread, array yes or no?
Replies: 21
Views: 37936

Re: Multi thread, array yes or no?

However, it was wanted to start a certain number of threads through a for () loop and then, when one of them ends, a new thread starts in its place. The example I gave you on Feb 5th does exactly that. sorry Remy, Once a thread terminates, it can't be reused. I had missed this sentence of yours, wh...
by mark_c
Fri Feb 07, 2020 12:53 am
Forum: Technical
Topic: Multi thread, array yes or no?
Replies: 21
Views: 37936

Re: Multi thread, array yes or no?

thanks Remy.
However, it was wanted to start a certain number of threads through a for () loop and then, when one of them ends, a new thread starts in its place.

Thanks again
by mark_c
Thu Feb 06, 2020 4:40 am
Forum: Technical
Topic: Multi thread, array yes or no?
Replies: 21
Views: 37936

Re: Multi thread, array yes or no?

thanks Remy. If I have understood your code well, making these changes, as you also suggested to me, I can always keep in memory, for example, the same 5 threads and when one of these ends pass a new topic to this. I don't know if the changes I made to your code are correct to ultimately get 5 threa...
by mark_c
Wed Feb 05, 2020 11:14 am
Forum: Technical
Topic: Multi thread, array yes or no?
Replies: 21
Views: 37936

Re: Multi thread, array yes or no?

I still take advantage of your skills and ask you: we said that if I instantiate n threads without arrays, I lose all references and, if I want to do something about one of them, I can no longer do anything. By setting the FreeOnTerminate = true property; it is true that a thread is terminated at it...
by mark_c
Tue Feb 04, 2020 2:17 am
Forum: Technical
Topic: custom socket set OnError event
Replies: 22
Views: 41119

Re: custom socket set OnError event

great Remy as always. In this version of the code, if I introduce a certain number of attempts when ByteReceived == 0, would it make sense? I thought that ByteReceived returns 0 if at that moment the buffer is perhaps full or the server is overloaded: could it be so? #include <memory> void __fastcal...
by mark_c
Fri Jan 31, 2020 1:34 pm
Forum: Technical
Topic: custom socket set OnError event
Replies: 22
Views: 41119

Re: custom socket set OnError event

thanks Remy.
So your advice is: with blocking sockets forget about events.

Anyway, I was insisting on the old road just to understand, thanks again Remy.
by mark_c
Thu Jan 30, 2020 12:49 am
Forum: Technical
Topic: Multi thread, array yes or no?
Replies: 21
Views: 37936

Re: Multi thread, array yes or no?

thanks Remy. After some tests I found this method to trace the handle of the thread that ends. void __fastcall TForm1::ThreadTerminated(TObject *Sender) { ThreadsRunning--; if (ThreadsRunning == 0) Caption = "Terminated"; TMyThread *MyTh = dynamic_cast<TMyThread*> (Sender); Memo2->Lines->Add( "stop:...
by mark_c
Wed Jan 29, 2020 1:21 pm
Forum: Technical
Topic: custom socket set OnError event
Replies: 22
Views: 41119

Re: custom socket set OnError event

thanks Remy. because if I instantiate only 1 thread I don't lose data instead, if I instantiate 5 with different ip addresses I lose data? With 5 threads the data is truncated. void __fastcall TMyThread::Execute() { TClientSocket *MySock = new TClientSocket(NULL); MySock->Address = myadr; MySock->Po...
by mark_c
Wed Jan 29, 2020 4:57 am
Forum: Technical
Topic: custom socket set OnError event
Replies: 22
Views: 41119

Re: custom socket set OnError event

thanks Remy. Another thing I didn't understand: if I create a class that is similar to the one you showed me, and I instantiate n threads, do I finally have a private OnRead event for each thread? class TMyThread : public TThread { private: protected: void __fastcall Execute(); void __fastcall Socke...
by mark_c
Tue Jan 28, 2020 2:25 pm
Forum: Technical
Topic: custom socket set OnError event
Replies: 22
Views: 41119

Re: custom socket set OnError event

......
by mark_c
Tue Jan 28, 2020 2:13 pm
Forum: Technical
Topic: custom socket set OnError event
Replies: 22
Views: 41119

Re: custom socket set OnError event

this is a version where I try to extend the TClientSocket class but it doesn't compile and I don't understand why. The reason is that I want to implement the events unlinked from the Form but I don't know if it is the correct way. class MyTestClass : public TClientSocket { private: protected: public...