is anyone checking into this issue? I looked into other forums and i ran accross this as someone's serverlist.cs file. Here are the contents:
// ServerList.cs
using System;
using System.Collections;
using System.Net;
using Server;
using Server.Network;
namespace Server.Misc
{
public class ServerList
{
public static string ServerName = "RunUO Test Center";
public static int ServerPort = 2593;
public static bool ServerUsingRouter = false ;
public static bool ServerRouterIPAutoUpdate = false ;
public static string RouterAddress = "__PUT_YOUR_ROUTER_IP_OR_ADDRESS_HERE_";
public static TimeSpan RouterIPAutoUpdateRate = TimeSpan.FromMinutes( 5.0 ) ;
private static IPAddress[] RouterIP ;
private static ArrayList LANIPs = null ;
private static ArrayList NetIPs = null ;
public static void Initialize()
{
Listener.Port = ServerPort;
SetIPList();
UpdateRouterIP();
EventSink.ServerList += new ServerListEventHandler( EventSink_ServerList );
}
#region IPMatch methods and related.
public static bool IPMatch( IPAddress ComparerIP, IPAddress IPMask, IPAddress ComparedIP )
{
return IPMatch( ComparerIP.Address, IPMask.Address, ComparedIP.Address ) ;
}
public static bool IPMatch( IPAddress ComparerIP, long IPMask, IPAddress ComparedIP )
{
return IPMatch( ComparerIP.Address, IPMask, ComparedIP.Address ) ;
}
public static bool IPMatch( long ComparerIP, long IPMask, long ComparedIP )
{
return ( ( ComparerIP & IPMask ) == ( ComparedIP & IPMask ) ) ;
}
public static bool IPMatch( IPAddress ComparerIP, int BitMask, IPAddress ComparedIP )
{
return IPMatch( ComparerIP.Address, BitMask, ComparedIP.Address ) ;
}
public static bool IPMatch( long ComparerIP, int BitMask, long ComparedIP )
{
return IPMatch( ComparerIP, (long) ( ( 1 << BitMask ) - 1 ) << ( 32 - BitMask ), ComparedIP ) ;
}
#endregion
private static bool IsLANAddress( IPAddress address )
{
if( IPMatch( 10 << 24, 8, address.Address) || // Local: 10.0.0.0\8
IPMatch( 172 << 24 + 16 << 16, 12, address.Address ) || // Local: 172.16.0.0\12
IPMatch( 192 << 24 + 168 << 16, 16, address.Address ) ) // Local: 192.168.0.0\16
{
return true ;
}
return false ;
}
public static void SetIPList( )
{
IPHostEntry thisHost = Dns.Resolve( Dns.GetHostName() );
IPAddress[] addressList = thisHost.AddressList;
LANIPs = new ArrayList() ;
NetIPs = new ArrayList() ;
foreach( IPAddress address in addressList )
{
if ( ! IPAddress.IsLoopback( address ) )
{
if ( IsLANAddress( address ) )
LANIPs.Add( address ) ;
else
{
if ( ! IPMatch( 198 << 24 + 18 << 16, 15, address.Address ) && // 198.18.0.0\15: Benchmark IPs
! IPMatch( 192 << 24 + 2 << 8, 24, address.Address ) && // 192.0.2.0\24: "TEST-NET" for Documentation and exemple code
! IPMatch( 169 << 24 + 254 << 16, 16, address.Address ) ) // 169.254.0.0\16: Link local (allocated for communication between hosts on a single link)
{
NetIPs.Add( address ) ;
}
}
}
}
if( LANIPs.Count == 0 )
LANIPs = null ;
if( NetIPs.Count == 0 )
NetIPs = null ;
}
public static void UpdateRouterIP( )
{
IPHostEntry host = null;
try
{
host = Dns.Resolve( RouterAddress ) ;
}
catch {}
finally
{
if ( host != null )
RouterIP = host.AddressList ;
else
{
if ( ServerUsingRouter )
Console.WriteLine( "ServerList: Invalid router address. Router support deactivated." ) ;
ServerUsingRouter = false ;
ServerRouterIPAutoUpdate = false ;
}
}
}
public class ServerUpdateTimer : Timer
{
public ServerUpdateTimer() : base( RouterIPAutoUpdateRate, RouterIPAutoUpdateRate )
{
Priority = TimerPriority.OneMinute;
if ( ServerUsingRouter && ServerRouterIPAutoUpdate )
this.Start();
}
protected override void OnTick()
{
if ( ! ServerRouterIPAutoUpdate )
this.Stop() ;
else
UpdateRouterIP() ;
}
}
public static void EventSink_ServerList( ServerListEventArgs e )
{
bool OneAddressAdded = false ; // True when at least one address as been added.
IPAddress RemoteIP = ((IPEndPoint)e.State.Socket.RemoteEndPoint).Address ;
// Check for Loopback address.
if( IPAddress.IsLoopback( RemoteIP ) )
{
e.AddServer( "Loopback " + ServerName, new IPEndPoint( IPAddress.Loopback, ServerPort ) );
OneAddressAdded = true ;
}
// Check for LAN if connected to one.
if( LANIPs != null && LANIPs.Count > 0 && IsLANAddress( RemoteIP ) )
{
for( int i = 0; i < LANIPs.Count; i ++ )
{
e.AddServer( String.Format( "LAN{0} ", ( i == 0 ) ? "" : (i + 1).ToString() ) + ServerName, new IPEndPoint( (IPAddress)LANIPs, ServerPort ) ) ;
OneAddressAdded = true ;
}
}
if( ! OneAddressAdded && RouterIP != null )
{
OneAddressAdded = true ;
}
else
{
if( NetIPs != null && NetIPs.Count > 0 )
{
for( int i = 0; i < NetIPs.Count; i ++ )
{
e.AddServer( String.Format( "{0}{1}", ServerName, ( i == 0 ) ? "" : (i + 1).ToString() ), new IPEndPoint( (IPAddress)NetIPs, ServerPort ) ) ;
OneAddressAdded = true ;
}
}
}
if( ! OneAddressAdded )
e.Rejected = true ;
}
}
}
Is this the proper way to set up the serverlist.cs file so that internet and lan games can play together at the same time on the same map?