Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
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 Go to previous message
dolik.rce is currently offline  dolik.rce
Messages: 1789
Registered: August 2008
Location: Czech Republic
Ultimate Contributor

Hi lectus, I see couple problems Smile

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 Wink

Best regards,
Honza
 
Read Message
Read Message
Read Message
Previous Topic: Witz and map variable
Next Topic: Witz and Skylark weird behaviour (possibly a bug)
Goto Forum:
  


Current Time: Mon May 13 20:11:26 CEST 2024

Total time taken to generate the page: 0.02356 seconds