public void Start(string hostPeerName) { if (this.IsConnected) { throw new InvalidOperationException(string.Format("Cannot start client. Client is already connected to {0}", this.HostUri)); } if (string.IsNullOrEmpty(hostPeerName)) { throw new ArgumentException("Cannot have a null or empty host peer name"); } PeerNameResult peerRecord = PeerResolution.ResolveHostName(hostPeerName); if (peerRecord != null) { this.HostUri = peerRecord.Uri; this.Port = peerRecord.Port; try { if (this.IntelServiceProxy == null) { System.ServiceModel.Channels.Binding netBinding = new NetTcpBinding(SecurityMode.None); EndpointAddress endpointAddress = new EndpointAddress(string.Format("net.tcp://{0}:{1}/IntelService", this.HostUri, this.Port)); IntelServiceProxy = new IntelProxy(netBinding, endpointAddress); } Enter(); OnStarted(); } catch (ArgumentException ex) { Stop(); throw ex; } } }
public void Start(string hostPeerName) { if (this.IsConnected) throw new InvalidOperationException(string.Format("Cannot start client. Client is already connected to {0}", this.HostUri)); if (string.IsNullOrEmpty(hostPeerName)) throw new ArgumentException("Cannot have a null or empty host peer name"); PeerNameResult peerRecord = PeerResolution.ResolveHostName(hostPeerName); if (peerRecord != null) { this.HostUri = peerRecord.Uri; this.Port = peerRecord.Port; try { if (this.IntelServiceProxy == null) { System.ServiceModel.Channels.Binding netBinding = new NetTcpBinding(SecurityMode.None); EndpointAddress endpointAddress = new EndpointAddress(string.Format("net.tcp://{0}:{1}/IntelService", this.HostUri, this.Port)); IntelServiceProxy = new IntelProxy(netBinding, endpointAddress); } Enter(); OnStarted(); } catch (ArgumentException ex) { Stop(); throw ex; } } }