Design two servers together using only one port
I'm a newbie to working with servers and I have a server design question. I currently have two separate application servers that work together in the following way:
The initial connection is made with server1 which makes a few decisions(about port number and other arguments) and starts server2 with those arguments on the same machine (I would have access to the process handle of all that were created). All further requests come directly to each server2 from each client. Because of the data we are handling individual versions of server2 are needed per client. (our load isn't big so that's never an issue)
What becomes a problem is the chosen port numbers. They are not always open for our clients. So my question is how can I redesign this system so I still have individual versions of server2 but that all requests come and go through server1 instead so only its port is used externally (all ports are available internally on the machine the servers are running on)? For instance is it possible to make the two servers 'talk' to each other somehow, maybe get one to redirect to the other? would the TCP specifications become the same for multiple clients if I tried to do this? Is it possible to do this at all or do I have to rethink the entire system?
(if it matters at all, both servers are written with c++ exactly as the Poco library suggests in their documentation)
I don't need specific code just some guidelines about what possibilities exist. Any help and suggestions will be greatly appreciated.