Thread: Patching Issues
View Single Post
Old 08-07-2008, 12:08 PM   #2 (permalink)
Melchior
Forum Expert
 
Join Date: Dec 2005
Posts: 272
Default

You should try to patch to 6.0.9.2 too; look where your files are installed (standard in c:\program files\ea games etc) and look for a sub-directory \Patch. If there are files in it, delete them and restart patching. Is this the same machine on which your server is running? If that's true then your server will have the latest patch too (client and server need the same patch level, as do clients that will connect remotely). Also, you need to check 'Patch client encryption' in razor

The IP number that you need to type in the drop-down box: Locally: 127.0.0.1 or your local LAN IP address (check with CommandPrompt>IPCONFIG/all)(10.5.1.2?). Remote: warriorshaven.servegame.com. You also need to put the external IP (warriorshaven.servegame.com) number into your Scripts\Misc\ServerList.cs.

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 = "warriorshaven.servegame.com";


		public const string ServerName = "Warriors Haven";

		public static void Initialize()
		{
			Listener.Port = 2593;

			EventSink.ServerList += new ServerListEventHandler( EventSink_ServerList );
		}

		public static void EventSink_ServerList( ServerListEventArgs e )
		{
			try
			{
				IPAddress ipAddr;

				if ( Resolve( Address != null && !IsLocalMachine( e.State ) ? Address : Dns.GetHostName(), out ipAddr ) )
					e.AddServer( ServerName, new IPEndPoint( ipAddr, Listener.Port ) );
				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;
		}
	}
}

Last edited by Melchior; 08-07-2008 at 12:24 PM.
Melchior is offline   Reply With Quote