Home » U++ Library support » U++ MT-multithreading and servers » How to close Skylark server except using Ctrl+C
How to close Skylark server except using Ctrl+C [message #36887] |
Tue, 17 July 2012 04:46 |
kasome
Messages: 78 Registered: July 2008 Location: Taiwan
|
Member |
|
|
Hello,
i am trying to use the Skylark to do something like the following
class WebServer : public SkylarkApp {
public:
void StopServer();
void StartServer();
};
class SimpleGUI : public TopWindow , public WebServer {
public:
SimpleGUI() {
StartServer();
}
virtual ~SimpleGUI() {
StopServer();
}
}
GUI operation for desktop user, and web operation for smart phone user.
so i try to modify the code, like
class WebServer : public SkylarkApp {
public:
WebServer() {
Run();
}
virtual ~WebServer(){
}
void StopServer() {
TheApp().quit = true;
TcpSocket h;
h.Connect("127.0.0.1", TheApp().port);
h.Put("quit");
}
void StartServer() {
for( int i=0; i<threads; ++i ) {
Thread::Start( THISBACK(ThreadRun) );
}
}
virtual void Main() {
}
};
and it didn't work apparently,
well, is there better way to close Skylark server except using Ctrl+C ?
[Updated on: Tue, 17 July 2012 05:03] Report message to a moderator
|
|
|
Goto Forum:
Current Time: Mon May 13 07:50:23 CEST 2024
Total time taken to generate the page: 0.04468 seconds
|