|
I was trying to be extra smart by implamenting typesafe collections in Managed C++. But, MC++ doesnot support covariant types.
You can't have
__property MyItem* get_Item(int index)
{
}
Because IList already has such a property.
I checked Nish's article he got away because he just implemented ICollextion and not IList.
|
|
|
|
|
TcpListener.AcceptTcpClient is a blocking call. How do I elegantly stop the call? From another thread say I want to stop listening. If I call TcpListener.Stop on the TcpListener object I get an exception. Some funny exception about how I halted a blocking operation. Right now I am putting an empty try{}...catch{} block and evading this exception. But there must be a more elegant solution! Any help is hugely appreciated!
Warm regards
Nish
Author of the romantic comedy
Summer Love and Some more Cricket [New Win]
Review by Shog9
Click here for review[NW]
|
|
|
|
|
Untested; but give this a shot. Instead of calling AcceptTcpClient() from the start; make calls to Pending() instead, and when it returns true THEN make the call to AcceptTcpClient .
Since that probably sounds convoluted, here's some code to illustrate it
TcpListener tcpL = ....;
tcpL.Start();
while(bShouldAcceptConnections)
{
if( tcpL.Pending() )
{
TcpClient tcpC = tcpL.AcceptTcpClient();
}
}
tcpL.Stop(); HTH,
James
"Java is free - and worth every penny." - Christian Graus
|
|
|
|
|
Yes, I have an application using pretty much the same logic and it works ok.
Andres Manggini.
Buenos Aires - Argentina.
|
|
|
|
|
Hello,
I make a dll, which exports classes, in order to use it in VB
The dll works, but function with pointer parameters (using array) do not...
if someone can help me...
Mau
|
|
|
|
|
thank you for your help
|
|
|
|
|
|
He's not happy that he didn't get a reply in less than 24 hours when he posted his question in the wrong forum
James
"Java is free - and worth every penny." - Christian Graus
|
|
|
|
|
James T. Johnson wrote:
He's not happy that he didn't get a reply in less than 24 hours when he posted his question in the wrong forum
I see. I was confused because the first post was by Mao. The second was anonymous and I wasn't sure about Mao posting anonymously.
Nish
Author of the romantic comedy
Summer Love and Some more Cricket [New Win]
Review by Shog9
Click here for review[NW]
|
|
|
|
|
I'm confused
The message "Thanks for your help "
doesn't represent a bad think...
It was simply my ironic death, the
death of the lost programmer...
anonymous why i don't know...
|
|
|
|
|
Has anyone been able to use a System::Timers::Timer object in their Managed C++ code?
I can't get it to be recognized by the compiler, yet the help documentation indicates it is a .NET class and there is C++ support for the types.
Can anyone point me to a header file to include or some example code somewhere.
Thanks
Jim
|
|
|
|
|
|
For the following class header member declaration
System::Timers::Timer* timer ;
Yeilds the following error
"error C2039: 'Timers' is not a member of 'System'"
|
|
|
|
|
You need #using <system.dll>
I have never wasted time worrying about such insignificant things. Keep your eye upon the donut and NOT upon the hole. - Bill Sergio about posting in the right forum. The Lounge - June 23, 2002
|
|
|
|
|
No that is not it. I tried that first. If you put in a
#using System::Timers ;
statement you get an "error C006 '#using' : expected a filename, found 'identifier'
Thanks though.
|
|
|
|
|
silversmith wrote:
#using System::Timers ;
You cannot do that. System::Timers is a namespace name. You need to use using namespace System::Timers;
|
|
|
|
|
|
If Rama's understanding of your problem is correct you have a compiler error. If so, put this on top as he has suggested :-
#using <system.dll>
Nish
Author of the romantic comedy
Summer Love and Some more Cricket [New Win]
|
|
|
|
|
|
I didn't know that. I think what you have done would translate to the same thing in C#. Wouldn't it? But why is that important.
I have never wasted time worrying about such insignificant things. Keep your eye upon the donut and NOT upon the hole. - Bill Sergio about posting in the right forum. The Lounge - June 23, 2002
|
|
|
|
|
|
Yes you can. It's called a vector of vectors. Someone told me you can use STL in MC++ if you don't care about interop.
Christian
I am completely intolerant of stupidity. Stupidity is, of course, anything that doesn't conform to my way of thinking. - Jamie Hale - 29/05/2002
Half the reason people switch away from VB is to find out what actually goes on.. and then like me they find out that they weren't quite as good as they thought - they've been nannied. - Alex, 13 June 2002
|
|
|
|
|
Christian Graus wrote:
Yes you can. It's called a vector of vectors. Someone told me you can use STL in MC++ if you don't care about interop.
But I was talking about managed arrays CG.
Nish
Author of the romantic comedy
Summer Love and Some more Cricket [New Win]
|
|
|
|
|
Nishant S wrote:
But I was talking about managed arrays CG.
Well, I dunno to what degree they can interexist. Obviously you'd have no interop, but I see no point in interop unless you have a language that is actually vastly different to C++ to interop with.
And either way I thought it was worth pointing out that jagged arrays are not a new idea.
Christian
I am completely intolerant of stupidity. Stupidity is, of course, anything that doesn't conform to my way of thinking. - Jamie Hale - 29/05/2002
Half the reason people switch away from VB is to find out what actually goes on.. and then like me they find out that they weren't quite as good as they thought - they've been nannied. - Alex, 13 June 2002
|
|
|
|
|
Christian Graus wrote:
And either way I thought it was worth pointing out that jagged arrays are not a new idea.
I know that. That's why I wonder why they left it out of the managed extensions. But I have got info that it will be included in the next release of the VC++ compiler
Nish
Author of the romantic comedy
Summer Love and Some more Cricket [New Win]
|
|
|
|