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.
Server01Table
Slave IP Addresses: 1.1.1.1, 2.2.2.2, 3.3.3.3 and so on.
Server02Table
Slave IP Addresses: 4.4.4.4, 5.5.5.5, 6.6.6.6 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??