Re: Redirect a connection
A suggestion, maybe allow the users to connect to any server. And if the server has no more allowed connection then it will go to the next one. Basically check if the server is full not for the specific number of clients connected.
Anyway the Main Server will also have to act like a client (Server/Client) so it can connect to the Sub Servers.
Re: Redirect a connection
That wont work since the client already is created for another protocol.
If the client connects to the main server, and I sent information about the client to one of the sub servers, and then the sub server connects to the client instead of the client connecting to the sub server, is that possible?
Re: Redirect a connection
I meant that the main server has to have both the server and client side in it if you are going to be doing what you are trying. How else will the MainServer connect to the SubServers?
Re: Redirect a connection
You can't redirect a client to another server if the client is using a different protocol that doesn't have any kind of redirection functionality in it.
Re: Redirect a connection
This a common enough that load balancing routers exist to handle it.
There is no real way to "redirect" an accepted TCP connection... or even one that hasn't yet been accepted. You either use a special router or design a "front end" server that performs this function. In either case though the "router" device/program will have to relay all of the conversation with the servers behind it.
If you had the luxury of designing the client/server protocol and the clients and servers the method suggested above would be good: Have one server that clients connect to first to get back the address of a second sever (from a group of secondary servers) to make a "working" connection to.
I wouldn't be surprised to find that there are Linux or BSD packages you can install on an old PC to make it into a TCP load balancing router. This probably isn't the solution you're hoping for though.