コード例 #1
0
ファイル: RadioSystem.cs プロジェクト: pboyd04/Moto.Net
        public IPAddress GetIPForRadio(RadioID id)
        {
            Radio r = FindRadioByID(id);

            if (r != null && r is IPRadio)
            {
                IPRadio ir = (IPRadio)r;
                return(ir.Endpoint.Address);
            }
            byte[] tmp = new byte[4];
            id.AddToArray(tmp, 0, 4);
            tmp[0] = 12;
            return(new IPAddress(tmp));
        }
コード例 #2
0
ファイル: RadioSystem.cs プロジェクト: pboyd04/Moto.Net
 public Radio FindRadioByEndpoint(IPEndPoint ep)
 {
     if (this.master != null && this.master.Endpoint.Equals(ep))
     {
         return(master);
     }
     foreach (Radio r in this.peers)
     {
         IPRadio ir = (IPRadio)r;
         if (ir.Endpoint.Equals(ep))
         {
             return(r);
         }
     }
     //TODO handle remote radios
     return(null);
 }