The problem you are having is that each server list is trying to add itself twice. You have to have the IP/Port/Name information for each server in your serverlist.cs file.
In this file, I have changes the Address and ServerName variables to Address1 & ServerName1, as well as added a Port1. I have also made another copy of those varables but changed the 1 to a 2 (Address2, ServerName2, Port2). Then I modified the two if statments to each make a server entry (see code).
PHP Code:
using System;
using System.Net;
using System.Net.Sockets;
using Server;
using Server.Network;
namespace Server.Misc
{
public class ServerList
{
/* Address:
*
* The default setting, a value of 'null', will attempt to detect your IP address automatically:
* private const string Address = null;
*
* This detection, however, does not work for servers behind routers. If you're running behind a router, put in your IP:
* private const string Address = "12.34.56.78";
*
* If you need to resolve a DNS host name, you can do that too:
* private const string Address = "shard.host.com";
*/
//public const string Address = null;
public const string Address1 = "127.0.0.1";
public const string ServerName1 = "Roadmaster's Abyss";
public const int Port1 = 2593;
public const string Address2 = "127.0.0.1";
public const string ServerName2 = "Roadie's Test Center";
public const int Port2 = 2592;
public static void Initialize()
{
Listener.Port = Port1;
EventSink.ServerList += new ServerListEventHandler( EventSink_ServerList );
}
public static void EventSink_ServerList( ServerListEventArgs e )
{
try
{
IPAddress ipAddr;
if ( Resolve( Address1 != null && !IsLocalMachine( e.State ) ? Address : Dns.GetHostName(), out ipAddr ) )
e.AddServer( ServerName1, new IPEndPoint( ipAddr, Port1 ) );
else if ( Resolve( Address2 != null && !IsLocalMachine( e.State ) ? Address : Dns.GetHostName(), out ipAddr ) )
e.AddServer( ServerName2, new IPEndPoint( ipAddr, Port2 ) );
else
e.Rejected = true;
}
catch
{
e.Rejected = true;
}
}
public static bool Resolve( string addr, out IPAddress outValue )
{
try
{
outValue = IPAddress.Parse( addr );
return true;
}
catch
{
try
{
IPHostEntry iphe = Dns.Resolve( addr );
if ( iphe.AddressList.Length > 0 )
{
outValue = iphe.AddressList[iphe.AddressList.Length - 1];
return true;
}
}
catch
{
}
}
outValue = IPAddress.None;
return false;
}
private static bool IsLocalMachine( NetState state )
{
Socket sock = state.Socket;
IPAddress theirAddress = ((IPEndPoint)sock.RemoteEndPoint).Address;
if ( IPAddress.IsLoopback( theirAddress ) )
return true;
bool contains = false;
IPHostEntry iphe = Dns.Resolve( Dns.GetHostName() );
for ( int i = 0; !contains && i < iphe.AddressList.Length; ++i )
contains = theirAddress.Equals( iphe.AddressList[i] );
return contains;
}
}
}
If you use this serverlist on your main server (Roadmaster's Abyss), you will see both Roadmaster's Abyss & Roadie's Test Center in your serverlist in the client. You technically don't even need to have your 2nd server display the server list if your primary server is the server that you will be connecting through (ie. that is the server you have set up in UOG). The only think you need to do with it is make sure the second server's listening port is set to the port you want it to listen to. Your secondary server wont be used to choose a server to connect to, only your primary server.
However, one thing you will need to know is that since your primary server will be handling the logins, any accounts you have on the secondary server MUST exist on the primary server.