} //Feito public override IEnumerable <PlayerPC> GetPlayers() { List <WCFPlayerPC> pcs = new List <WCFPlayerPC>(); Uri probeEndpointAddress = new Uri(CompleteServerAddress); NetTcpBinding binding = new NetTcpBinding(); binding.Security.Mode = SecurityMode.None; binding.Security.Transport.ProtectionLevel = System.Net.Security.ProtectionLevel.None; DiscoveryEndpoint discoveryEndpoint = new DiscoveryEndpoint(binding, new EndpointAddress(probeEndpointAddress)); DiscoveryClient discoveryClient = new DiscoveryClient(discoveryEndpoint); try { FindResponse findResponse = discoveryClient.Find(new FindCriteria(typeof(IPlayer))); WCFPlayerPC pc; foreach (var endpoint in findResponse.Endpoints) { try { NetTcpBinding bindingPC = new NetTcpBinding(); binding.Security.Mode = SecurityMode.None; binding.Security.Transport.ProtectionLevel = System.Net.Security.ProtectionLevel.None; PlayerProxy client = new PlayerProxy(binding, endpoint.Address); client.Open(); List <WCFScreenInformation> displays = client.GetDisplayInformation().ToList <WCFScreenInformation>(); client.Close(); pc = new WCFPlayerPC() { Displays = displays, Endpoint = endpoint.Address }; pcs.Add(pc); } catch (EndpointNotFoundException) { continue; } } } catch { return(null); } return(pcs.Cast <PlayerPC>()); } //Feito
public override void Open() { if (!(pc is WCFPlayerPC)) { return; } try { NetTcpBinding binding = new NetTcpBinding(SecurityMode.None) { ReceiveTimeout = new TimeSpan(0, 5, 0) }; WCFPlayerPC wcfComputer = pc as WCFPlayerPC; player = new PlayerProxy(binding, wcfComputer.Endpoint); player.Open(); } catch { } }//Feito
public WCFConnection(WCFPlayerPC pc) : base(pc) { this.ServerIP = pc.IP; this.ServerPort = pc.Port; }