コード例 #1
0
        public DynamicEthernetNetwork()
        {
            _ethernet = Microsoft.SPOT.Net.NetworkInformation.NetworkInterface.GetAllNetworkInterfaces()[0];
            if (_ethernet == null)
            {
                throw new NullReferenceException();
            }

            _ethernet.EnableDhcp();
        }
コード例 #2
0
ファイル: Network.cs プロジェクト: jeittreim/FishNET
        public static int netconn()
        {
            int result = 0;

            Microsoft.SPOT.Net.NetworkInformation.NetworkInterface nf = Microsoft.SPOT.Net.NetworkInformation.NetworkInterface.GetAllNetworkInterfaces()[0];
            if (!nf.IsDhcpEnabled)
            {
                Debug.Print("dhcp not enabled, setting up");
                nf.EnableDhcp();
                nf.RenewDhcpLease();
                Thread.Sleep(10000);
            }
            if (nf.IPAddress == "0.0.0.0")
            {
                result = 1;
            }
            else
            {
                result = 0;
            }
            return(result);
        }