Thanks Koen.
>________________________________
> From: Koen Deforche <k...@emweb.be>
>To: Neil D'Souza <nxd...@yahoo.com>; witty-interest@lists.sourceforge.net
>Sent: Friday, September 28, 2012 1:39 AM
>Subject: Re: [Wt-interest] Clean easy way to get to WServer from inside
>WApplication
>
>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
>>
>
>
>
------------------------------------------------------------------------------
Got visibility?
Most devs has no idea what their production app looks like.
Find out how fast your code is with AppDynamics Lite.
http://ad.doubleclick.net/clk;262219671;13503038;y?
http://info.appdynamics.com/FreeJavaPerformanceDownload.html
_______________________________________________
witty-interest mailing list
witty-interest@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/witty-interest