DynDns Netduino - Netduino Plus 2 (and Netduino Plus 1) - Netduino Forums
   
Netduino home hardware projects downloads community

Jump to content


The Netduino forums have been replaced by new forums at community.wildernesslabs.co. This site has been preserved for archival purposes only and the ability to make new accounts or posts has been turned off.
Photo

DynDns Netduino


Best Answer Djeizan, 09 February 2016 - 08:46 PM

I´m use this code and work:

 

Netduino plus 2

Firmware:v4.3.2.1

 

 

    public static class NoIPDNSUpdater
    {
        private static Thread threadDaemon;
        private const string _Domain = "mydomain.noip.me";
        private const string _IP = "";
        private const string _Username = "myuser";
        private const string _Password = "mypassword";
        private static int _HeartBeat = 300000;
 
        public static void StartDaemon()
        {
            if (threadDaemon == null || !threadDaemon.IsAlive)
            {
                threadDaemon = new Thread(Daemon);
                threadDaemon.Start();
            }
        }
        private static void Daemon()
        {
            while(true)
            {
                DynamicUpdate(_Domain, _IP, _Username, _Password);
                Thread.Sleep(_HeartBeat);
            }            
 
        }
        /// <summary>
        /// Update the DNS information in no-ip Service.</summary>
        /// <param name="pHostName"> The host name in no-ip service.</param>
        /// <param name="pMyip"> Optional: if empty the service no-ip get the wan address.</param>
        /// <param name="pUsername"> Username of service.</param>
        /// <param name="pPassword"> Password of service.</param>
        private static void DynamicUpdate(string pHostname, string pMyip, string pUsername, string pPassword)
        {
            try
            {
                HttpWebRequest req = (HttpWebRequest) HttpWebRequest.Create("http://dynupdate.no-...date?hostname="+ pHostname + "&myip=" + pMyip);
                req.Credentials = new NetworkCredential(pUsername, pPassword);
                using (var res = (HttpWebResponse)req.GetResponse())
                {
                    // Do something with the response accordingly to
                    // http://www.noip.com/integrate/response
                }
            }
            catch (Exception ex)
            {
                string a = ex.Message;
            }
        }
Go to the full post


  • Please log in to reply
1 reply to this topic

#1 Djeizan

Djeizan

    Member

  • Members
  • PipPip
  • 11 posts

Posted 08 February 2016 - 07:55 PM

Hello friends
 
Has anyone implemented a dyndns client on Netduino?


#2 Djeizan

Djeizan

    Member

  • Members
  • PipPip
  • 11 posts

Posted 09 February 2016 - 08:46 PM   Best Answer

I´m use this code and work:

 

Netduino plus 2

Firmware:v4.3.2.1

 

 

    public static class NoIPDNSUpdater
    {
        private static Thread threadDaemon;
        private const string _Domain = "mydomain.noip.me";
        private const string _IP = "";
        private const string _Username = "myuser";
        private const string _Password = "mypassword";
        private static int _HeartBeat = 300000;
 
        public static void StartDaemon()
        {
            if (threadDaemon == null || !threadDaemon.IsAlive)
            {
                threadDaemon = new Thread(Daemon);
                threadDaemon.Start();
            }
        }
        private static void Daemon()
        {
            while(true)
            {
                DynamicUpdate(_Domain, _IP, _Username, _Password);
                Thread.Sleep(_HeartBeat);
            }            
 
        }
        /// <summary>
        /// Update the DNS information in no-ip Service.</summary>
        /// <param name="pHostName"> The host name in no-ip service.</param>
        /// <param name="pMyip"> Optional: if empty the service no-ip get the wan address.</param>
        /// <param name="pUsername"> Username of service.</param>
        /// <param name="pPassword"> Password of service.</param>
        private static void DynamicUpdate(string pHostname, string pMyip, string pUsername, string pPassword)
        {
            try
            {
                HttpWebRequest req = (HttpWebRequest) HttpWebRequest.Create("http://dynupdate.no-...date?hostname="+ pHostname + "&myip=" + pMyip);
                req.Credentials = new NetworkCredential(pUsername, pPassword);
                using (var res = (HttpWebResponse)req.GetResponse())
                {
                    // Do something with the response accordingly to
                    // http://www.noip.com/integrate/response
                }
            }
            catch (Exception ex)
            {
                string a = ex.Message;
            }
        }

  • Evo likes this




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users

home    hardware    projects    downloads    community    where to buy    contact Copyright © 2016 Wilderness Labs Inc.  |  Legal   |   CC BY-SA
This webpage is licensed under a Creative Commons Attribution-ShareAlike License.