⚲
Project
General
Profile
Sign in
Register
Home
Projects
Help
Search
:
Wt
All Projects
Wt
Overview
Activity
Roadmap
Issues
Wiki
Forums
Download (1.09 KB)
Feature #5604
ยป server_test.cpp
Kayra Akman
, 03/16/2017 01:11 PM
#include
<Wt/WServer>
#include
<Wt/WApplication>
#include
<Wt/WEnvironment>
#include
<Wt/WContainerWidget>
#include
<Wt/WIOService>
#include
<Wt/WText>
using
namespace
Wt
;
WApplication
*
createApplication
(
const
WEnvironment
&
env
)
{
auto
*
app
=
new
Wt
::
WApplication
(
env
);
app
->
root
()
->
addWidget
(
new
Wt
::
WText
(
"text"
));
return
app
;
}
int
main
(
int
argc
,
char
*
argv
[])
{
try
{
Wt
::
WServer
server
(
argc
,
argv
);
server
.
addEntryPoint
(
Wt
::
Application
,
createApplication
);
server
.
ioService
().
schedule
(
5
*
1000
,
[
&
](){
server
.
stop
();
});
server
.
ioService
().
schedule
(
15
*
1000
,
[
&
](){
// server.resume();
server
.
start
();
});
server
.
run
();
std
::
cout
<<
"server stopped"
<<
std
::
endl
;
}
catch
(
Wt
::
WServer
::
Exception
&
e
)
{
std
::
cout
<<
"Wt::WServer::Exception"
<<
std
::
endl
;
std
::
cerr
<<
e
.
what
()
<<
std
::
endl
;
}
catch
(
std
::
exception
&
e
)
{
std
::
cout
<<
"std::exception"
<<
std
::
endl
;
std
::
cerr
<<
"exception: "
<<
e
.
what
()
<<
std
::
endl
;
}
}
(1-1/1)
Loading...