>Hello!
>There is WServer::instance() method.
Many Thanks for the reply,
I achieved this somewhat differently.
For some reason I had the wrong impression that after server.start(), it went
into the infinite loop.
However, Then I realised "Wt::WServer::waitForShutdown();" would not have
been called, but it does. So, I just put in the required code before that call
- as below.
if (server.start()) {
std::cout << "server started, port number: "
<< server.httpPort() << std::endl;
Wt::WServer::waitForShutdown();
.
.
.
WServer::instance() would also work for me, I am sure.
Kind Regards,
Neil
>________________________________
> From: Nagaev Boris <bnag...@gmail.com>
>To: Neil D'Souza <nxd...@yahoo.com>; witty-interest@lists.sourceforge.net
>Sent: Monday, September 3, 2012 4:31 PM
>Subject: Re: [Wt-interest] Clean easy way to get to WServer from inside
>WApplication
>
>On Mon, Sep 3, 2012 at 2:38 PM, Neil D'Souza <nxd...@yahoo.com> wrote:
>> 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
>>
>
>
>
------------------------------------------------------------------------------
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