How do I close a TCP connection? #1638
-
Environment
|
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 3 replies
-
Please correct me where my guessing was off. A proper client disconnect can be observed on the HTTP client example and is explained in detail in the error handling tutorial |
Beta Was this translation helpful? Give feedback.
-
I re-ran the test, both sides are using Mongoose, when the server and client are running on different devices, the server can receive the MG_EV_CLOSE event. When running on the same device, the server cannot receive the MG_EV_CLOSE event. |
Beta Was this translation helpful? Give feedback.
-
Please check the examples and tutorials, you can not call |
Beta Was this translation helpful? Give feedback.
Please check the examples and tutorials, you can not call
mg_close_conn(conn); mg_mgr_free(mgr));
like that (no example does that), as already explained.If you don't want to exit the program, then just don't exit the main loop (and of course don't free resources). All examples that don't exit do just that.
Please post the smallest piece of code showing what you want to do and can't do.