I’m developing an application that should run on multiple machines with different tasks/roles, but synchronized (some kind of load balanced (game)server where some machines process the different worlds, one machine handles chat and inventories, other machines handle incoming network connections…).
Right at the beginning, the application instances should create TCP connections between each other. But how would I implement this in C#?
First of all you need the load balancing servers which can contact the correct gaming servers. That’s probably the weakest point in the architecture. You can limit the risk by using DNS round robin and multiple load balancers.
If all your servers are placed on the same network you can use UDP broadcasting to allow the load balancers to automatically discover all game servers. The packets would be something like “Hey, I’m an inventory server, connect to me” where the load balancing server then would create a TCP connection which is solely used to monitor the game server (CPU usage etc to make sure that the server doesn’t get too much work).