RunUO Community

This is a sample guest message. Register a free account today to become a member! Once signed in, you'll be able to participate on this site by adding your own topics and posts, as well as connect with other members through your own private inbox!

A little bit of a strange problem...

bilros02

Wanderer
A little bit of a strange problem...

Hi there everyone, Ive recently gotten my server up and running and after some issues got Jump on there, confirming that others could log on as well and make accounts.

Well, apparently my brothers computer is different. Even when others can log on, he still cant, and when the server is running and he tries to connect it tells him that the shard must no longer be up and operational. He tried connecting using Razor and also with ConnectUO, but cant find the shard listed on ConnectUO so he only uses Razor instead with no success. He's put ithe server number and port numbers correctly, still nothing, and the last time he tried he ended up connecting to ABC instead, which is weird as hell.

Heres some information that may be helpful, but then again, I dont know what could possibly be wrong: He patched the UO client to its latest patch, reinstalled Razor to its newest version, and still doesnt work. Hes at his own place and is behind his own wireless network, I dont know if that matters or not...

Please help, the purpose of my shard is to allow all friends and family to play, and my brother is going to be the one in charge of new buildings and such.
 

Malaperth

Wanderer
Well, I don't know who or how you successfully got someone to connect, but if one person from outside your lan can connect to your wan IP, one would guess that somehow he is not using the correct IP and/or port, or your console would show something. Your IP could have changed since the last person successfully connected for example.
 

bilros02

Wanderer
Possibly, but I gave him the most recent IP addresses (last night) and also am using Fixits Serverlist.cs, so it should autoupdate as well.

We're pretty much super stumped on this one. If you want to try and connect to it to see if YOU can do it, then heres the server address:
24.160.199.80

You know the port number already.

Oh, and it showed on my console that he was trying to connect. It showed him as connecting, then instantly disconnecting and then trying to reconnect and failing to do so.

Heres what the console said when he tried:
Login: 63.134.154.172: Valid credentials for 'obitomkinobi
Player is reconnecting to 255.255.255.255
Client: 63.134.154.172: Disconnected
 

bilros02

Wanderer
Client: **.**.***.***: Connecred. [2 online]
Login: **.**.***.***: Creating new account 'Malaperth'
Player is reconnecting to 255.255.255.255
Client: **.**.***.***: Disconnected. [1 Online] [Malaperth]

Thats what it said.
 

Malaperth

Wanderer
Looks to me like you have something horribly wrong in a router forward, firewall, or script. I have never seen that Player is reconnecting to line.

What version of RunUO are you using?
 

bilros02

Wanderer
Im using RunUO 2.0 RC1

the newest as of like a week ago or so....

Did you manage to connect though? Its odd that only one person cant...
 

Malaperth

Wanderer
No, I did not manage to connect although I did reach the server. And RC1 is RC1 and has not changed since it was put up for download. The only thing that has changed is the SVN. So which are you using? Also, post the copy of MrFixit's serverlist.cs (in code tags please). I looked through the RunUO server code and cannot find anything that would output that 'reconnecting' line to the console.
 

bilros02

Wanderer
I dont have SVN, thats for sure, so I just have RC1.

And here is the Mr. Fixit Serverlist.cs:
Code:
// ==================================================================================================
// ServerList.cs
// ==================================================================================================
//    	1.0 	RunUO Beta 36	Initial version
//    	1.1 	Mr Fixit	Now automaticly detects if you are connecting localy and uses the
//				servers local ip in the client serverlist.
//	1.2	Mr Fixit	Internet IP autodetection using www.whatismyip.com.
//  	1.3	Mr Fixit	If script fails to find the internet ip, keep the old one and try
//				again in # minutes.
//      1.4	Mr Fixit	You can now add AutoIP mirrors. Added whatismyip.com and myip.com.
//      1.5	Mr Fixit	Adjusted the AutoIP mirror engine so it supports more mirrors.
//				Added findmyip.com and ipaddy.com.
//      1.6	Mr Fixit	IP is now trimmed (Just in case). Added simflex.com, edpsciences.com,
//				ipid.shat.net and checkip.dyndns.org.
//      1.7     Mr Fixit        Removed www.whatismyip.com is it seems to be out of buisness.
//      1.8     Mr Fixit        Added a message to the console with ServerList.cs version when server loads.
//				Now detects the internet ip when the server starts.
//				Now checks if the ip has changed every 60 minutes instead of 30 minutes.
//      1.9     Mr Fixit        Removed noip.com mirror as it isnt working anymore.
//      2.0     Mr Fixit        Now only renews the ip every 24 hours (1440 minutes).
// ==================================================================================================

using System;
using System.Net;
using System.Net.Sockets;
using Server;
using Server.Network;

namespace Server.Misc
{
	public class ServerList
	{

		// ==================================================================================
		// YOUR SERVERS NAME
		// ==================================================================================
		public const string ServerName = "Gaia Saga: Black Hand Rising";

		// ==================================================================================
		// YOUR INTERNET IP OR DNS NAME
		// Here you can select to autodetect your internet ip, or manualy specify
		// Examples:
		// public static string Address = "24.160.199.80";
		// public static string Address = "gaia.host.com";
		// ==================================================================================
		public const bool InternetIPAutodetect = true;
		public const int MinutesBetweenIPAutodetect = 1440;
		public static string Address = null;
		
		// ==================================================================================
		// Here are some values stored
		// ==================================================================================
		private static LocalLanIPRange[] LocalLanIPRanges = new LocalLanIPRange[10];		
		private static UInt32 LocalLanIPRangesCount;
		private static AutoIPMirror[] AutoIPMirrors = new AutoIPMirror[10];	
		private static UInt32 AutoIPMirrorsCount;
		private static DateTime InternetIPAutodetectLast;
		

		// ==================================================================================
		// Initialization
		// ==================================================================================
		public static void Initialize()
		{
			// ----------------------------------------------------
			// Select what port to use
			// ----------------------------------------------------
			Listener.Port = 2593;

			// ----------------------------------------------------
			// Load the local LAN ip ranges
			// ----------------------------------------------------
			AddLocalLANIPRange("10.0.0.0", "10.255.255.255");
			AddLocalLANIPRange("192.168.0.0", "192.168.255.255");
			AddLocalLANIPRange("172.16.0.0", "172.32.255.255");
			AddLocalLANIPRange("169.254.0.0", "169.254.255.255");

			// ----------------------------------------------------
			// Load the Auto IP mirros
			// ----------------------------------------------------
			AddAutoIPMirror("http://www.findmyip.com/", "Your IP address is:<br>", "</FONT>");
			AddAutoIPMirror("http://www.ipaddy.com/", "Your IP address is: ", "<br>");
			AddAutoIPMirror("http://checkip.dyndns.org/", "Current IP Address: ", "</body>");
			AddAutoIPMirror("http://ipid.shat.net/iponly/", "<title>", "</title>");
			AddAutoIPMirror("http://www.edpsciences.com/htbin/ipaddress", "Your IP address is  <B> ", " </B>");
			AddAutoIPMirror("http://www2.simflex.com/ip.shtml", "Your IP address is <BR>", "<BR>");
			
			// ----------------------------------------------------
			// Create the event
			// ----------------------------------------------------
			EventSink.ServerList += new ServerListEventHandler( EventSink_ServerList );
			
			// ----------------------------------------------------
			// Show info in console
			// ----------------------------------------------------
			Console.WriteLine("Serverlist.cs: 2.0");
			
			// ----------------------------------------------------
			// Lets find internet ip
			// ----------------------------------------------------
			DetectInternetIP();
			
			
		}
		

		// ==================================================================================
		// Add a range of local lan ips
		// ==================================================================================
		private static void AddLocalLANIPRange(string RangeFrom, string	RangeTo)
		{
			LocalLanIPRanges[LocalLanIPRangesCount] = new LocalLanIPRange();
			LocalLanIPRanges[LocalLanIPRangesCount].RangeFrom = StringIPToUInt32IP(RangeFrom);
			LocalLanIPRanges[LocalLanIPRangesCount].RangeTo = StringIPToUInt32IP(RangeTo);
			LocalLanIPRangesCount = LocalLanIPRangesCount + 1;
		}
		
		
		// ==================================================================================
		// Convert a ip string to a binary unsigned int
		// ==================================================================================
		private static UInt32 StringIPToUInt32IP(string addr)
		{
			byte[] byteArray1 = IPAddress.Parse(addr).GetAddressBytes();
			byte[] byteArray2 = IPAddress.Parse(addr).GetAddressBytes();
			byteArray1[0] = byteArray2[3];
			byteArray1[1] = byteArray2[2];
			byteArray1[2] = byteArray2[1];
			byteArray1[3] = byteArray2[0];
			return  BitConverter.ToUInt32( byteArray1, 0);
		}
		

		// ==================================================================================
		// Used to store the local lan ip ranges
		// ==================================================================================
		private class LocalLanIPRange
		{
			public UInt32			RangeFrom;
			public UInt32			RangeTo;
		}	


		// ==================================================================================
		// Add a AutoIP mirror
		// ==================================================================================
		private static void AddAutoIPMirror(string sURL, string	sStart, string sEnd)
		{
			AutoIPMirrors[AutoIPMirrorsCount] = new AutoIPMirror();
			AutoIPMirrors[AutoIPMirrorsCount].sURL = sURL;
			AutoIPMirrors[AutoIPMirrorsCount].sStart = sStart;
			AutoIPMirrors[AutoIPMirrorsCount].sEnd = sEnd;
			AutoIPMirrorsCount = AutoIPMirrorsCount + 1;
		}


		// ==================================================================================
		// Used to store the Auto IP mirrors
		// ==================================================================================
		private class AutoIPMirror
		{
			public string			sURL;
			public string			sStart;
			public string			sEnd;
			public UInt32			iFailures;
		}	


		// ==================================================================================
		// Detect ip
		// ==================================================================================
		public static void DetectInternetIP()
		{

			// ----------------------------------------------------
			// Autodetect the Internet IP
			// ----------------------------------------------------
			if (InternetIPAutodetect) {
				DateTime UpdateTime = InternetIPAutodetectLast;
				UpdateTime = UpdateTime.AddMinutes(MinutesBetweenIPAutodetect);
				if (UpdateTime<DateTime.Now) {
					string NewAddress = null;
					NewAddress = FindInternetIP();
					InternetIPAutodetectLast = DateTime.Now;
					if (NewAddress!=null) 
					{
						Address = NewAddress;
					}
				}
			}
			
		}

		// ==================================================================================
		// The serverlist event
		// ==================================================================================
		public static void EventSink_ServerList( ServerListEventArgs e )
		{
			try
			{

				// ----------------------------------------------------
				// Lets find internet ip
				// ----------------------------------------------------
				DetectInternetIP();
				
				// ----------------------------------------------------
				// Find the server ip to use for this user
				// ----------------------------------------------------
				IPAddress ipAddr = FindMachineIP(e);
				
				// ----------------------------------------------------
				// Send serverlist
				// ----------------------------------------------------
				if (ipAddr != null)
				{
					e.AddServer( ServerName, new IPEndPoint( ipAddr, Listener.Port ) );
				} else {
					e.Rejected = true;
				}
			}
			catch
			{
				e.Rejected = true;
			}
		}
		
		
		// ==================================================================================
		// Connects to a webserver that gives you your internet ip
		// ==================================================================================
                public static string FindInternetIP( )
		{

			// ----------------------------------------------------
			// Pick a random mirror
			// ----------------------------------------------------
			Random rnd = new Random();
			int UseMirror = (int)( rnd.NextDouble() * AutoIPMirrorsCount);
			string MyIP = "";
			
			// ----------------------------------------------------
			// Catch if the mirror is down
			// ----------------------------------------------------
			try
			{
				// ----------------------------------------------------
				// Get the webpage
				// ----------------------------------------------------
        	    		WebClient client = new WebClient();
            			byte[] pageData = client.DownloadData(AutoIPMirrors[UseMirror].sURL);
            			MyIP = System.Text.Encoding.ASCII.GetString(pageData);
            		
				// ----------------------------------------------------
				// Find the string
				// ----------------------------------------------------
                        	int iStart = MyIP.LastIndexOf(AutoIPMirrors[UseMirror].sStart);   
                        	int iEnd = MyIP.IndexOf(AutoIPMirrors[UseMirror].sEnd, iStart+AutoIPMirrors[UseMirror].sStart.Length);
                        	MyIP = MyIP.Substring(iStart+AutoIPMirrors[UseMirror].sStart.Length, iEnd-iStart-AutoIPMirrors[UseMirror].sStart.Length );
                        	MyIP = MyIP.Trim();
                        	
				// ----------------------------------------------------
				// Return value
				// ----------------------------------------------------
                        	Console.WriteLine("Internet IP: {0} ({1})", MyIP, AutoIPMirrors[UseMirror].sURL);
        	                return MyIP;
			}
			catch
			{
				Console.WriteLine("Unable to autoupdate the Internet IP from {0}!", AutoIPMirrors[UseMirror].sURL);
				Console.WriteLine("----------------------------------------------------------------------");
				Console.WriteLine(MyIP);
				Console.WriteLine("----------------------------------------------------------------------");
				return null;
			}
        	}
		
		
		// ==================================================================================
		// Calculates what server IP to use
		// ==================================================================================
                public static IPAddress FindMachineIP( ServerListEventArgs e )
		{
			// ----------------------------------------------------
			// Find the IP of the connecting user
			// ----------------------------------------------------
			Socket sock = e.State.Socket;
			IPAddress theirAddress = ((IPEndPoint)sock.RemoteEndPoint).Address;				
			IPAddress serverAddress;

			// ----------------------------------------------------
			// Is it Loopback?
			// ----------------------------------------------------
			if ( IPAddress.IsLoopback( theirAddress ) )
			{
				return IPAddress.Parse( "127.0.0.1" );
			}

			// ----------------------------------------------------
			// Local
			// ----------------------------------------------------
			UInt32 uint32Address = StringIPToUInt32IP(theirAddress.ToString());
			for (UInt32 LocalLanIPRangesLoop = 0 ; LocalLanIPRangesLoop < LocalLanIPRangesCount; LocalLanIPRangesLoop++)
			{	
				if ( (LocalLanIPRanges[LocalLanIPRangesLoop].RangeFrom <= uint32Address) && (LocalLanIPRanges[LocalLanIPRangesLoop].RangeTo >= uint32Address) )
				{
					Resolve(Dns.GetHostName(), out serverAddress);
					
					Console.WriteLine("Player is reconnecting to " + serverAddress.ToString());
					return serverAddress;
				}
			}

			// ----------------------------------------------------
			// Internet addresses
			// ----------------------------------------------------
			if (Address!=null)
			{
				Resolve(Address, out serverAddress);	
			} else {
				Resolve(Dns.GetHostName(), out serverAddress);	
			}
			
			Console.WriteLine("Player is reconnecting to " + serverAddress.ToString());
			return serverAddress;
		}
		

		// ==================================================================================
		// Resolves dns names
		// ==================================================================================
		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;
		}

	}
}
 

Malaperth

Wanderer
Well, somehow, that serverlist.cs is resolving your IP address to 255.255.255.255. Restart the server now so your IP gets resolved now and I'll try again and maybe we can see if it's an error resolving your IP address or something in the serverlist.cs itself. You may have to go back to the distro serverlist.cs and edit that accordingly...

PS... those are not code tags, those are quote tags. code is the # symbol.
 

bilros02

Wanderer
:) I know, I wasnt thinking and put the qoutes instead, then quickly changed it back...Ill post something when I restart the server...and its restarted...:)
 

Malaperth

Wanderer
Your IP has changed... I suggest you get a no-ip account and use that as your ip addy in the distro serverlist.cs. Or at least get a no-ip account so that everyone will be able to log on and you won't have to notify everyone you know of an IP change.
 

bilros02

Wanderer
Alright....how do I go about doing that and what kind of changes do I need to make to everything Ive already done?
 

Malaperth

Wanderer
If you use MrFixit's (and the problem isn't actually caused by that script) you won't have to change anything except that you will give out the no-ip dns name you choose instead of your numerical ip.
 

Malaperth

Wanderer
bilros02;688591 said:
And IPchicken is still telling me that my IP address is the same as it was before...Im confused

Then somehow your lan IP changed because I got no reply from that IP at all.
 

bilros02

Wanderer
Could you try again to connect? Because what I think happened was I got an error randomly from a script I DLed and I had to delete it and restart the server around the same time as you were getting on...maybe you tried to connect while it was restarting or something
 

Malaperth

Wanderer
Try changing the autoupdate for the IP in fixit's serverlist to 15 minutes or so. That may help as I was able to connect.

Code:
public const int MinutesBetweenIPAutodetect = 15;
 

bilros02

Wanderer
Ok, I changed what you told me and now its 15 instead of that long number. So do you think this will solve the issue??
 
Top