Home » U++ Library support » U++ MT-multithreading and servers » How to break the server loop ?
Re: How to break the server loop ? [message #44658 is a reply to message #44657] |
Thu, 07 May 2015 08:36 |
|
akebee wrote on Thu, 07 May 2015 08:05Hi dolik.rce
Im not in POSIX , its Windows.
Now i send a request to my server socket when program-quit, if recieved the specific request the server thread will break and exit.
Is this a good solution ?
It's 'possible' solution Depends on your actual needs. The biggest problem with this solution is, that anyone can remotelly shut down your server, so it is definitelly good for public projects (unless there is reliable authetication & authorization). But for small projects it might be ok, I've used it in past too
If you wan't something better I'd suggest you to try reading about the timeouts in TcpSocket. If you set timeout to reasonably small value (or 0, to make it nonblocking, as I suggest previously), shutting the server down should take just slightly longer than the timeout value. This should work well on any platform, including windows.
Honza
|
|
|
Goto Forum:
Current Time: Mon Jun 10 00:16:02 CEST 2024
Total time taken to generate the page: 0.01006 seconds
|