public void AbortProxy() { if (proxy != null) { proxy.Abort(); proxy.Close(); proxy = null; } }
public void Connect(User p) { OptionalReliableSession OptionalReliableSession = new OptionalReliableSession { Enabled = true, InactivityTimeout = TimeSpan.MaxValue, Ordered = true }; NetTcpSecurity netTcpSecurity = new NetTcpSecurity { Mode = SecurityMode.None }; XmlDictionaryReaderQuotas readerQuotas = new XmlDictionaryReaderQuotas { MaxDepth = 32 * 2, MaxStringContentLength = 8192 * 2, MaxArrayLength = 16384 * 2, MaxBytesPerRead = 4096 * 2, MaxNameTableCharCount = 16384 * 2 }; NetTcpBinding netTcpBinding = new NetTcpBinding { Name = "DuplexBinding", ReceiveTimeout = TimeSpan.FromMinutes(10 * 2), ReliableSession = OptionalReliableSession, Security = netTcpSecurity, CloseTimeout = TimeSpan.FromMinutes(2), SendTimeout = TimeSpan.FromMinutes(2), OpenTimeout = TimeSpan.FromMinutes(2), ReaderQuotas = readerQuotas, MaxBufferPoolSize = 524288 * 2, MaxReceivedMessageSize = 65536 * 2, HostNameComparisonMode = HostNameComparisonMode.StrongWildcard, ListenBacklog = 10 * 2, MaxBufferSize = 65536 * 2, MaxConnections = 48 * 2, TransactionFlow = false, TransferMode = TransferMode.Buffered, PortSharingEnabled = false, Namespace = "http://tempuri.org/" }; InstanceContext site = new InstanceContext(this); proxy = new ChatProxy(site, netTcpBinding, new EndpointAddress(Uri)); IAsyncResult iar = proxy.BeginJoin(p, new AsyncCallback(OnEndJoin), null); }