public override bool Equals(object obj) { if (obj is RemoteTagetInfo) { RemoteTagetInfo other = (RemoteTagetInfo)obj; if (info.Equals(other.info) && port == other.port) { 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); } } }