Hey Neil, Just for completeness (for anyone else googling for this). You can get the server instance from: environment().server()
WServer::instance() would also mostly work, unless you are having more than one instance around (which is something rare, but nevertheless supported !). Regards, koen 2012/9/3 Neil D'Souza <nxd...@yahoo.com>: > Hello All, > > Is there any way to access the Wt::WServer from inside the WApplication? > > Currently, below is what I am doing, but i dont think this is very neat > and there might be a better way, or something I missed in the documentation > In the WApplication class. > > Wt::WServer server; > Wt::WApplication *createApplication(const Wt::WEnvironment& env) > { > return new HelloApplication(env, false, server); > } > > Wt::WApplication *createWidgetSet(const Wt::WEnvironment& env) > { > return new HelloApplication(env, true, server); > } > > Why do I need this? > I need a dynamic port number for a wt exe application which I launch after > compiling it through a web interface. I searched for documentation on this > and found that if you pass 0 to the port number, the OS will allocate you a > port number dynamically. This works with the Wt executeable. > > Once this is done , I wish to print the port number (capture it in some way) > and create a URL which points to where the application is running, so that > users can visit it. > > I am able to do all of the above, but just wanted to know if there is a > neater way of doing this i.e. avoiding the global variable. > > Thanks, > Neil > > > > ------------------------------------------------------------------------------ > Live Security Virtual Conference > Exclusive live event will cover all the ways today's security and > threat landscape has changed and how IT managers can respond. Discussions > will include endpoint security, mobile security and the latest in malware > threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ > _______________________________________________ > witty-interest mailing list > witty-interest@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/witty-interest > ------------------------------------------------------------------------------ Everyone hates slow websites. So do we. Make your web apps faster with AppDynamics Download AppDynamics Lite for free today: http://ad.doubleclick.net/clk;258768047;13503038;j? http://info.appdynamics.com/FreeJavaPerformanceDownload.html _______________________________________________ witty-interest mailing list witty-interest@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/witty-interest