-
-
Notifications
You must be signed in to change notification settings - Fork 1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Question]:How to close all connections and restart the gnet tcp server after certain time? #485
Comments
Call Engine.Stop to stop the server gracefully and you can start the server over. I think you should look into the documentation more carefully before |
I have code below:
|
You get the |
thanks for reply!
}` the full code thanks:
|
I figure out I can put a loop in main to re Run gnet , since eng.Stop just quit the program, but I got this error if get error with if there any socket connected , if there is no any connected, no error,: Server start failed: bind: address already in use only have to wait around 30 seconds , the gnet can start again, any idea???
|
This is caused by If you must restart your server immediately, there are two ways:
|
option 2 with Options.WithReuseAddr or Options.WithReusePort works great!! thanks SO how to set |
gnet now supports setting |
done! works like a charm !
|
I think you misunderstood my previous comments about |
works fine, any good place I can set Options.WithReuseAddr or Options.WithReusePort. version works also fine!!! |
I told you a fancy problem: After we applied |
Actions I've taken before I'm here
Questions with details
How to close all connections and restart the gnet tcp server after a certain period of time?
please make a full example with push example,
it seems gnet lack of good documentation
thank you very much
Code snippets (optional)
No response
The text was updated successfully, but these errors were encountered: