It's pretty easy to get the IP address.
Just use the HTTP commands to access a website that returns your IP address. (There is one on the game creators website, but I cant remember the address.) Then your slave app will connect to the server and give it the IP address. The server will store the IP address in a table relating to whatever server is hosting that particular game.
For example, the main server will have a database something like this.
Slave IP Addresses: 220.127.116.11, 18.104.22.168, 22.214.171.124 and so on.
Slave IP Addresses: 126.96.36.199, 188.8.131.52, 184.108.40.206 and so on.
Server01 will connect to the master server and look for new IP address, then allow that machine to connect.
Likewise, the slave will ask the master server for the IP address for the selected server to initiate the connection.
If this makes sense??