Hello,
I have a project like that :
.....
TestClass t;
for (i=1;i<=x;i++)
{
t=new TestClass(params);
t.Save();
}
....
In the constructor of TestClass, if params has a particular value, I create
a TCPClient, connect it to a serveur, and run a (asynch) beginread.
When a read some data, I resend some other , ...
If all is good, the dialog is max 2-3 second long
My question :
Is that good ?
when I write t=new ..., I think I lost the reference to the precedent
constructed class, so what with the asynch callback? it's destructed and
never called ?
And if i'm wrong, what is the best solution to correct that ?
The for() is for example? Normaly it's data readed from a stream (serialport
or TCP/IP), and I must create class taht represent Event readed.
Thx 3 1531
Do you want to wait for the old instance of TestClass to complete? Then you
should use an AutoResetEvent, call WaitOne before instantiating new
TestClass, and Set after the operation is complete.
If you don't intend to wait for the operation to complete, you should keep
references to all TestClasses you've instantiated in a simple
List<TestClass>, for example.
"Geoffrey" <AE**************@dufour.be> wrote in message
news:uc**************@tk2msftngp13.phx.gbl... Hello,
I have a project like that : .... TestClass t; for (i=1;i<=x;i++) { t=new TestClass(params); t.Save(); } ...
In the constructor of TestClass, if params has a particular value, I create a TCPClient, connect it to a serveur, and run a (asynch) beginread. When a read some data, I resend some other , ... If all is good, the dialog is max 2-3 second long
My question : Is that good ? when I write t=new ..., I think I lost the reference to the precedent constructed class, so what with the asynch callback? it's destructed and never called ?
And if i'm wrong, what is the best solution to correct that ? The for() is for example? Normaly it's data readed from a stream (serialport or TCP/IP), and I must create class taht represent Event readed.
Thx
No, I don't want to wait to complete.
I wan't to be sure that all the TCP/IP communicatie are good completed.
So, I think I have to keep all references or make my tcp/ip communicatie
synchronous ...
And what if in testclass, I create a class ClassCommunicatie with a function
start.
And call this function in a ThreadStart() ?
"Lebesgue" <no****@spam.jp> a écrit dans le message de
news:Oz**************@TK2MSFTNGP10.phx.gbl... Do you want to wait for the old instance of TestClass to complete? Then
you should use an AutoResetEvent, call WaitOne before instantiating new TestClass, and Set after the operation is complete. If you don't intend to wait for the operation to complete, you should keep references to all TestClasses you've instantiated in a simple List<TestClass>, for example.
"Geoffrey" <AE**************@dufour.be> wrote in message news:uc**************@tk2msftngp13.phx.gbl... Hello,
I have a project like that : .... TestClass t; for (i=1;i<=x;i++) { t=new TestClass(params); t.Save(); } ...
In the constructor of TestClass, if params has a particular value, I create a TCPClient, connect it to a serveur, and run a (asynch) beginread. When a read some data, I resend some other , ... If all is good, the dialog is max 2-3 second long
My question : Is that good ? when I write t=new ..., I think I lost the reference to the precedent constructed class, so what with the asynch callback? it's destructed and never called ?
And if i'm wrong, what is the best solution to correct that ? The for() is for example? Normaly it's data readed from a stream (serialport or TCP/IP), and I must create class taht represent Event readed.
Thx
No, I don't want to wait to complete.
I wan't to be sure that all the TCP/IP communicatie are good completed.
So, I think I have to keep all references or make my tcp/ip communicatie
synchronous ...
And what if in testclass, I create a class ClassCommunicatie with a function
start.
And call this function in a ThreadStart() ?
"Lebesgue" <no****@spam.jp> a écrit dans le message de
news:Oz**************@TK2MSFTNGP10.phx.gbl... Do you want to wait for the old instance of TestClass to complete? Then
you should use an AutoResetEvent, call WaitOne before instantiating new TestClass, and Set after the operation is complete. If you don't intend to wait for the operation to complete, you should keep references to all TestClasses you've instantiated in a simple List<TestClass>, for example.
"Geoffrey" <AE**************@dufour.be> wrote in message news:uc**************@tk2msftngp13.phx.gbl... Hello,
I have a project like that : .... TestClass t; for (i=1;i<=x;i++) { t=new TestClass(params); t.Save(); } ...
In the constructor of TestClass, if params has a particular value, I create a TCPClient, connect it to a serveur, and run a (asynch) beginread. When a read some data, I resend some other , ... If all is good, the dialog is max 2-3 second long
My question : Is that good ? when I write t=new ..., I think I lost the reference to the precedent constructed class, so what with the asynch callback? it's destructed and never called ?
And if i'm wrong, what is the best solution to correct that ? The for() is for example? Normaly it's data readed from a stream (serialport or TCP/IP), and I must create class taht represent Event readed.
Thx
This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Nick Jacobson |
last post by:
Casting an 'enumerate' object destroys it?? Is that supposed to
happen, or is it a bug?
For example:
a =
e = enumerate(a)
print dict(e)
print dict(e)
|
by: Martin |
last post by:
Bit of a newbie question here (I'm familiar with OO in general, just
not in C++ yet).
I've seen code example where the general syntax for creating a new
object is as follows:
Thing a = new...
|
by: DrUg13 |
last post by:
In java, this seems so easy. You need a new object
Object test = new Object() gives me exactly what I want.
could someone please help me understand the different ways to do the
same thing in...
|
by: Zork |
last post by:
Hi,
I am trying to stop object creation (in this case ill use a ball as the
object) via use of exceptions. In essence, if the ball does not have an
owner, I do not want the ball object created....
|
by: Olumide |
last post by:
I'm studying Nigel Chapman's Late Night Guide to C++ which I think is
an absolutely fantastic book; however on page 175 (topic: operator
overlaoding), there the following code snippet:
inline...
| |
by: MR |
last post by:
help!
I have an unmanaged DLL that I do not have the source code, so i can't
recompile or make changes. the DLL requires a callback function. I would
like to implement the callback method in a...
|
by: Chewie2112 |
last post by:
Is there a way in VB to get a notification when an object
is destroyed when that object does not have a terminate
event?
I am using a control that does not have a notification
event when it is...
|
by: Jess |
last post by:
Hello,
If I create a temporary object using a dynamically created object's
pointer, then when the temporary object is destroyed, will the
dynamically created object be destroyed too? My guess...
|
by: Dormilich |
last post by:
recently I came over a piece of code where this question arose.
scenarion: a new object is created locally in a class's method, but when will this object be destroyed? (ok, at latest at script...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
| |
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...
| |