[Guide] Using Dynamic IP Addresses [Without Hamachi]

02/24/2012 01:05 Spirited#1
Hey everyone.

I've noticed that people seems to be obsessed with making their IP Address static. I know that in some cases (such as my case), a router might reject a static address because of the internet service provider's forced settings on the network.

A month ago, Cox Communications (my ISP) forced my router to DELETE the option of having a static address. I hate using Hamachi, so I come up with this solution:

Code:
if (server.NoIpHost != String.Empty)
{
       IPHostEntry ip = Dns.GetHostEntry(server.NoIpHost);
       server.IPAddress = ip.AddressList[0].ToString();
}
All you have to do is get a No-IP host and load that instead of the IP Address. Have the client connect to the host and it's good to go. I tested it and I use it for Burning Skies's test server. I can use this to launch my server from any location as well.

Hope this helps someone.
Sincerely,
Spirited Fang
02/24/2012 01:54 PretendTime#2
Woah that's awesome dude!
02/24/2012 06:30 12k#3
Should make a script that will auto login to a free dns host and change ur IP setting there on server start up ^^, that way it eliminates that step as well. (Also, just fyi, u can use ur domain too. If your using godaddy i know they allow multiple dns' to ur domain. Example yourdomain.com, server1.yourdomain.com, server2.yourdomain.com, etc)
02/24/2012 07:30 djneo31#4
Interesting, but where should I add this code???? :confused: :D :handsdown:
02/24/2012 08:38 Spirited#5
Quote:
Originally Posted by 12k View Post
Should make a script that will auto login to a free dns host and change ur IP setting there on server start up ^^, that way it eliminates that step as well. (Also, just fyi, u can use ur domain too. If your using godaddy i know they allow multiple dns' to ur domain. Example yourdomain.com, server1.yourdomain.com, server2.yourdomain.com, etc)
How does a domain solve the dynamic ip issue though? Isn't a script to do all of that a bit... much?

Quote:
Originally Posted by djneo31 View Post
Interesting, but where should I add this code???? :confused: :D :handsdown:
Where it is needed. Being a programmer means developing solutions to problems. The code I provided isn't complicated. Google should tell you everything you need to know about the method I used. As far as placing it in your source goes, I have no idea. It's not my source. You should open and read it instead of asking so many questions.
02/24/2012 11:24 dego4ever#6
thanks fang, but is there any reference should i add?
02/24/2012 11:42 Spirited#7
Quote:
Originally Posted by dego4ever View Post
thanks fang, but is there any reference should i add?
[Only registered and activated users can see links. Click Here To Register...]
[Only registered and activated users can see links. Click Here To Register...]
02/24/2012 12:21 dego4ever#8
O.o it's already in System.dll
thanks again,, :*
02/24/2012 13:01 JobvdH#9
Great release this would help allot for some people!
02/24/2012 15:42 U2_Caparzo#10
Quote:
Originally Posted by dego4ever View Post
thanks fang, but is there any reference should i add?
i would do it as a void
public static void GetIP()
the code that fang provided

define a string in Kernel, world(depending from your source) or server(fang's source)

then in program.cs in the Main method add something like

World.ServerIP = GetIP();

then each time u have to put your IP u just write
xxxxxx = World.ServerIP;
02/24/2012 15:53 zero_epvp#11
Thanks, really effective but how about making a loader where you put your domain name (No-Ip) insted the servers' Ip? I saw one released but its outdated. No-Ip have a application that`s updating your Ip with your domain name automatically at Windows startup. It's complicated to create such a programme?
02/24/2012 19:19 U2_Caparzo#12
Quote:
Originally Posted by zero_epvp View Post
Thanks, really effective but how about making a loader where you put your domain name (No-Ip) insted the servers' Ip? I saw one released but its outdated. No-Ip have a application that`s updating your Ip with your domain name automatically at Windows startup. It's complicated to create such a programme?
but u have to run the ConquerLoader with an IP, not a domain name i suppose, but u can just code a launcher/autopatcher(if u want) wich update the IP in the config file for the conquerLoader(LoaderSet.ini) if u apply the same code for source and launcher, u will be able to log-in w/o hamachi, including other PCs...
02/25/2012 06:20 12k#13
Quote:
Originally Posted by Fаng View Post
How does a domain solve the dynamic ip issue though? Isn't a script to do all of that a bit... much?
It may be a bit much, but it would require nothing to be changed manually when ur IP changes. And all a No-IP is, is a sub domain of one of their purchased domains pointing to ur IP. Any purchased domain comes with unlimited sub domains.
02/25/2012 11:09 Spirited#14
Conquer Loader v5.2 is what I use and it can handle No-Ip addresses in the IP field. It makes things simple for testing while your on a laptop that connects to multiple ip addresses in a day. I'm not suggesting that this should replace a VPS or anything professional. This is a just simple fix for a simple problem.
02/26/2012 13:48 marlyandedsel#15
is what I use For Co Loader Client and its working fine...... :)


HTML Code:
try
            {
                try
                {
                    IPHostEntry serverHE;
                    try
                    {
                        serverHE = Dns.GetHostEntry(Strings.DNS);
                    }
                    catch (Exception)
                    {
                        MessageBox.Show("Host not found");
                        Environment.Exit(1);
                        return;
                    }
                    IPAddress IP = serverHE.AddressList[0];
                    Strings.DNS = IP.ToString();
                }
                catch (Exception ex)
                {
                    Console.WriteLine(ex.ToString());
                }
                if (File.Exists(System.Windows.Forms.Application.StartupPath + @"\LoaderSet.ini"))
                {
                    File.Delete(System.Windows.Forms.Application.StartupPath + @"\LoaderSet.ini");
                    List<string> Lines = new List<string>();

                    Lines.Add("[Loader]");
                    Lines.Add("IPAddress="+Strings.DNS);
                    Lines.Add("LoginPort=" + Strings.AuthPort);
                    Lines.Add("GamePort="+Strings.GamePort);
                    File.WriteAllLines("LoaderSet.ini", Lines.ToArray());                    
                    try
                    {
                        Process p = new Process();
                        p.StartInfo.FileName = "ConquerLoader.exe";
                        p.StartInfo.CreateNoWindow = true;
                        p.StartInfo.Arguments = "/r";
                        p.Start();
                        Environment.Exit(1);
                    }
                    catch
                    {
                        MessageBox.Show("ConquerLoader.exe not found!");
                    }
                }
                else
                {                     
                    List<string> Lines = new List<string>();

                    Lines.Add("[Loader]");
                    Lines.Add("IPAddress=" + Strings.DNS);
                    Lines.Add("LoginPort=" + Strings.AuthPort);
                    Lines.Add("GamePort=" + Strings.GamePort);
                    File.WriteAllLines("LoaderSet.ini", Lines.ToArray());
                  try
                    {
                        Process p = new Process();
                        p.StartInfo.FileName = "ConquerLoader.exe";
                        p.StartInfo.CreateNoWindow = true;
                        p.StartInfo.Arguments = "/r";
                        p.Start();
                        Environment.Exit(1);
                    }
                    catch
                    {
                        MessageBox.Show("ConquerLoader.exe not found!");
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
                Environment.Exit(1);
            }