![]() |
|
Multi-Threaded Server Socket Connection + built in memory Load-Balancer - Printable Version +- Hack Forums (https://hackforums.net) +-- Forum: Tech (https://hackforums.net/forumdisplay.php?fid=444) +--- Forum: Coding (https://hackforums.net/forumdisplay.php?fid=151) +---- Forum: Software Development (https://hackforums.net/forumdisplay.php?fid=118) +---- Thread: Multi-Threaded Server Socket Connection + built in memory Load-Balancer (/showthread.php?tid=6269263) |
Multi-Threaded Server Socket Connection + built in memory Load-Balancer - nucleo_type09 - Apr 23, 2024 C++ Memory-Safe Multi-Threaded Server Socket Connection Program, can accept multiple connections at the same time using a detached thread for each connection operation, provides memory safety and concurrency control using locking mechanism, uses an internal built in memory load balancing mechanism, the library is very easy to use, just create an instance and call Connect on it, and the server is up and running, you don't need to handle extra configurations, manageable configurations are: [ip-address, port number, IDLE timeout, auto shutdown mechanism, max n of peers, etc...], memory cleanup is already handled by the destructor. Compiled using gcc compiler on Linux System using c++20, using additional memory security flags such as -fsanitizer-address for catching memory leaks, the full code and library documentation is on github, you can find it here: https://github.com/nucleoType98/Unix_Server_Socket.git ------------------------------------------------------------------------------------------------------------------------------------------------ Simple Connection Code #include "server.cpp"With More Configurations Code #include "server.cpp"BUMP - Stanley - Apr 23, 2024 I'm Stanley HF's helper bot. The OP (original poster) of this thread wants everyone to see this page and has elected to bump it to the top of the showthread listing. Since HF doesn't want a ton of LQP (Low Quality Posts) this is the best method of bumping your content. There is a small βyte fee for each bump. Any OP can bump any of their threads on HF from the linked icon on the top of their first post. If you haven't already read the first post of this thread we encourage you to do so. Thanks, Stanley RE: Multi-Threaded Server Socket Connection + built in memory Load-Balancer - Hackers - Apr 23, 2024 Nice, I didn't realize that this had load balancing already handled. Is this something where you could easily see this being used to have multiple chatrooms with their own groups of users connecting? Or would it be better just to run different instances of this same program on different ports? I'm assuming there's no reason you couldn't have multiple channels in 1 main server running on different ports, but just curious mostly. RE: Multi-Threaded Server Socket Connection + built in memory Load-Balancer - nucleo_type09 - Apr 23, 2024 (Apr 23, 2024 03:48 PM)nodes Wrote: Nice, I didn't realize that this had load balancing already handled. well it handles how many connections desired, they're all handled by different threads detached from the main thread, all using the same instance, with the same port yes, no need for more instances, just one instance, and all clients will hook to that instance, but i honestly i wrote this to serve another purpose rather than a chat room, it can even be used as a chat room server end point as well tho,as you said, it has builtin memory load balancer, which can be configured as well, it has an IDLE timeout builtin mechanism as well, so when there are no clients connected, it will automatically shutdown after X amount of seconds, this can also be configured haha 😛 |