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!

RunUO Remote Administrator

Ithron

Sorceror
I've tested your program.. nice work!

I've coded a similiar program in the past.. but not for remote users.


btw: i've coded a little fix for ipv6.. if you use localhost as address with windows 7 you can't connect.

Network.cs
Code:
/// <summary>
        /// 
        /// </summary>
        /// <param name="ipAddressOrHostName"></param>
        /// <param name="port"></param>
        /// <returns></returns>
        public bool Connect(string ipAddressOrHostName, int port)
        {
            if (Connected)
            {
                Disconnect();
            }

            BytesReceived = 0;
            BytesSent = 0;

            bool success = true;

			try
			{
				if (!IPAddress.TryParse(ipAddressOrHostName, out _serverAddress))
				{
					IPAddress[] ipAddresses = Dns.GetHostAddresses(ipAddressOrHostName);

					if (ipAddresses.Length == 0)
					{
						throw new NetworkException("Host address was unreachable or invalid, unable to obtain an ip address.");
					}
					else
					{
						ServerAddress = ipAddresses[0];

						if (ServerAddress.AddressFamily == AddressFamily.InterNetworkV6)
						{
							string ip = string.Empty;
							double doubleValue;

							try
							{
								string val = ServerAddress.ToString();
								val = val == "::1" ? "127.0.0.1" : val; // localhost in ipv6

								if (val != null)
								{
									if (Double.TryParse(val, System.Globalization.NumberStyles.Number, System.Globalization.CultureInfo.CurrentCulture, out doubleValue))
									{
										Console.WriteLine(val);
										ip = val;
									}
								}
							}
							catch
							{
								ip = "0.0.0.0";
							}

							IPAddress.TryParse(ip, out _serverAddress);
						}
					}
				}

				_log.Debug("Connecting...");

				_serverEndPoint = new IPEndPoint(_serverAddress, port);
				_serverSocket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
				_serverSocket.Connect(_serverEndPoint);

				if (_serverSocket.Connected)
				{
					_log.Debug("Connected.");

					SocketState state = new SocketState(_serverSocket, ushort.MaxValue);
					_serverSocket.BeginReceive(state.Buffer, 0, state.Buffer.Length, SocketFlags.None, OnReceive, state);
				}

			}
			catch (Exception e)
			{
				success = false;
				_log.Fatal(e);
				//throw;
			}

            Connected = success;
            return success;
        }


It's very interesting. I've never worked with WPF before, but it looks great. Thanks for this suggestion ^^
 

Jeff

Lord
Skitalets;839824 said:
A've been there but there was no link in Downloads section, only the source code.
But i don't know how to use it

Right, its not in a functional state, still development, thus there is no compiled version to download.
 

Skitalets

Wanderer
Jeff;840374 said:
Right, its not in a functional state, still development, thus there is no compiled version to download.

Waiting for a Final Version! Looks great on screenshots! When would it be?
 

Jeff

Lord
Skitalets;840376 said:
Waiting for a Final Version! Looks great on screenshots! When would it be?

Its a hobby project so dunno, i get to it when i can in my oh so busy life.
 

Tumeski

Sorceror
Linux style administration. Use SSH connections to send commands to turn server on? (etc. screen mono ":$HOME_DIR_PATH."RunUO.exe"

Easy as pie. Or supply everyone with simple startup scripts and control it :) I mean .sh file you know /startup.sh start/restart/stop/reload etc...

The layout is awesome for the app. Shitverlight is a cool piece of software.
 

Jeff

Lord
Tumeski;840859 said:
Linux style administration. Use SSH connections to send commands to turn server on? (etc. screen mono ":$HOME_DIR_PATH."RunUO.exe"

Easy as pie. Or supply everyone with simple startup scripts and control it :) I mean .sh file you know /startup.sh start/restart/stop/reload etc...

The layout is awesome for the app. Shitverlight is a cool piece of software.

WPF not silverlight, however, I might try to port it to Silverlight.
 

MarciXs

Sorceror
If I was working on something like this I would take different approach.
Is it allowed to post my approach or better not?
 

Jeff

Lord
MarciXs;840922 said:
If I was working on something like this I would take different approach.
Is it allowed to post my approach or better not?

You can post whatever you want, but Ill be honest up front, a lot of your ideas, are not intriguing to me :)
 

Tumeski

Sorceror
Jeff;840899 said:
WPF not silverlight, however, I might try to port it to Silverlight.

Ah. Just looking at the layout it felt like it was made with Silverlight... Well anyway, its still cool.
 
Tumeski;840965 said:
Ah. Just looking at the layout it felt like it was made with Silverlight... Well anyway, its still cool.

Jeff doesn't need Silverlight. He's so badass he can just tell the compiler what he wants it to do in plain English and it does exactly what he wants out of fear.
 

Jeff

Lord
MarciXs;840985 said:
uhm fair enough...
System.Runtime.Remoting .

Why would you use remoting.... are you kidding me... you want to open a portal to a non-secure world, awesome, do it on your own time. Not to mention that would be the most complicated approach, but from what I've seen, that is your favorite thing to do. Keep it simple stupid, comes to mind.
 

MarciXs

Sorceror
Jeff;841123 said:
Why would you use remoting.... are you kidding me... you want to open a portal to a non-secure world, awesome, do it on your own time. Not to mention that would be the most complicated approach, but from what I've seen, that is your favorite thing to do. Keep it simple stupid, comes to mind.

Which exactly is the "complicated" part? Creating an class that inherits MarshalByRefObject
create reflection methods in it? Such as

public void CallStatic(string type, string method,object[] pars)
{
Type t = Assembly.GetEntryAssembly().GetType(type);
MethodInfo m = t.GetMethod(method);
m.Invoke(null, pars);
}

then having a script that hosts it?
HttpChannel hChan = new HttpChannel(2554);
ChannelServices.RegisterChannel(hChan,false);
RemotingConfiguration.ApplicationName = "Admin";
RemotingConfiguration.RegisterWellKnownServiceType(new WellKnownServiceTypeEntry(typeof(WHATVERE), "Connect", WellKnownObjectMode.Singleton));

Then in whatever client ...like win app for example..
ChannelServices.RegisterChannel(new HttpChannel());
RemotingConfiguration.RegisterWellKnownClientType(new WellKnownClientTypeEntry(typeof(WHATVER), "http://localhost:2554/Admin/Connect"));

Open a portal? Huh? Do you know that most of web api's ask for developer's key?
So where's the problem of passing an username and password as parameters?

Very complicated.
 
Top