Home » U++ Library support » U++ MT-multithreading and servers » What's wrong with this code?
Re: What's wrong with this code? [message #38219 is a reply to message #38215] |
Fri, 07 December 2012 07:29 |
|
Hi lectus, I see couple problems
First you create the callbacks wrong. If you want to make callback to member function, you have to use the correct variant where you pass the object (you class) and fully qualified function name. The easiest way to do this is to use THISBACK* macros (requires "typedef ServerTest CLASSNAME;" in your class):
Thread().Run(THISBACK1(Accept, s));
Thread().Run(THISBACK(Serve)); ¨
Second thing that will not work is that you pass a socket as a parameter for the callback. TcpSocket has only private copy constructor, you you can't copy it into the callback so it can be used later. The socket should be member variable of your class, so you don't have to pass it around.
Also, Neil has a point about reading the manual and posting the complete compilable testcase. Or you should at least post the compiler messages if you want us to figure out why it won't compile, it is much easier then
Best regards,
Honza
|
|
|
Goto Forum:
Current Time: Mon May 13 20:11:26 CEST 2024
Total time taken to generate the page: 0.02356 seconds
|