Example #1
0
        public static RemoteDeviceInfo GetLocalDeviceInfo()
        {
            RemoteDeviceInfo deviceInfo = new RemoteDeviceInfo();

            deviceInfo.appName     = Application.productName;
            deviceInfo.appVersion  = Application.version;
            deviceInfo.deviceModel = SystemInfo.deviceModel;
            deviceInfo.deviceName  = SystemInfo.deviceName;
            deviceInfo.platform    = Application.platform;

            return(deviceInfo);
        }
Example #2
0
        protected override void DiscoverServer(IPEndPoint endPoint, string content)
        {
            RemoteDeviceInfo deviceInfo = null;

            deviceInfo = SimpleJsonUtils.FromJson <RemoteDeviceInfo>(content);
            if (deviceInfo == null)
            {
                deviceInfo         = new RemoteDeviceInfo();
                deviceInfo.appName = content;
            }
            discoveryPeersHandler.Add(deviceInfo, endPoint);
            //Debug.Log("DiscoverServer:" + endPoint + " Centent:" + content);
        }
Example #3
0
 public override bool Equals(object obj)
 {
     if (obj is RemoteDeviceInfo)
     {
         RemoteDeviceInfo other = (RemoteDeviceInfo)obj;
         if (appName == other.appName &&
             appVersion == other.appVersion &&
             deviceName == other.deviceName &&
             deviceModel == other.deviceModel &&
             platform == other.platform)
         {
             return(true);
         }
     }
     return(false);
 }
        public void Add(RemoteDeviceInfo deviceInfo, IPEndPoint remoteEndPoint)
        {
            string ipPortString = remoteEndPoint.ToString();

            //Debug.Log("ipPortString:" + ipPortString);
            if (discoverPeerTimeoutDic.ContainsKey(deviceInfo))
            {
                RemoteTagetInfo info = discoverPeerTimeoutDic[deviceInfo];
                info.timeOut = timeOut;
                if (remoteEndPoint.AddressFamily == AddressFamily.InterNetwork)
                {
                    info.address = remoteEndPoint.Address;
                }
                else
                {
                    info.addressV6 = remoteEndPoint.Address;
                }
            }
            else
            {
                RemoteTagetInfo info = new RemoteTagetInfo(deviceInfo);
                if (remoteEndPoint.AddressFamily == AddressFamily.InterNetwork)
                {
                    info.address = remoteEndPoint.Address;
                }
                else
                {
                    info.addressV6 = remoteEndPoint.Address;
                }
                info.port    = remoteEndPoint.Port;
                info.timeOut = timeOut;
                discoverPeerTimeoutDic.Add(deviceInfo, info);

                if (OnServerDiscover != null)
                {
                    OnServerDiscover(info);
                }
            }
        }
Example #5
0
 public RemoteTagetInfo(RemoteDeviceInfo info)
 {
     this.info = info;
     //this.endPoint = endPoint;
 }