public void Init(Binding binding) { this.fBinding = binding; this.fDataSocket = new Socket(binding.AddressFamily, binding.SocketType, binding.Protocol); if (!this.EnableNagle) this.fDataSocket.SetSocketOption(SocketOptionLevel.Tcp, SocketOptionName.NoDelay, 1); }
public Connection(Binding binding) { this.fSyncRoot = new Object(); this.Init(binding); this.SetDefaultValues(); }
public ConnectionPool(Binding bindingV4, Binding bindingV6) : base() { this.fBindingV4 = bindingV4; this.fBindingV6 = bindingV6; this.fCleanupTimer = new Timer(new TimerCallback(Cleanup), null, 30000, 30000); this.fMaxQueuePerHost = 5; this.fTimeout = 260; }
public ConnectionPool(Binding bindingV4, Binding bindingV6) { this.fCache = new Hashtable(); this.fBindingV4 = bindingV4; this.fBindingV6 = bindingV6; this.fCleanupTimer = new Timer(CleanupCallback, null, 30000, 30000); this.fMaxQueuePerHost = 5; this.Timeout = 260; }
public InnerConnection(Binding binding) : base(binding) { }
public SslConnection(SslConnectionFactory factory, Binding binding) : base((Socket)null) { this.fFactory = factory; this.fInnerConnection = new InnerConnection(binding); this.fInnerConnection.BufferedAsync = false; this.fInnerConnection.AsyncDisconnect += InnerConnection_AsyncDisconnect; this.fInnerConnection.AsyncHaveIncompleteData += InnerConnection_AsyncHaveIncompleteData; }
public Connection(Binding binding) { this.Init(binding); this.Initialize(); }
public virtual Connection GetNewConnection(EndPoint endPoint) { Binding lBinding; switch (endPoint.AddressFamily) { case AddressFamily.InterNetwork: lBinding = fBindingV4; break; case AddressFamily.InterNetworkV6: lBinding = fBindingV6; break; default: lBinding = new Binding(endPoint.AddressFamily); break; } Connection lConnection; if (this.fConnectionFactory != null) lConnection = this.fConnectionFactory.CreateClientConnection(lBinding); else if (fConnectionClass != null) lConnection = (Connection)Activator.CreateInstance(this.fConnectionClass); else lConnection = new Connection(lBinding); lConnection.Connect(endPoint); lConnection.LastUsed = DateTime.Now; lConnection.Pool = this; return lConnection; }
public virtual Connection CreateClientConnection(Binding binding) { if (!this.Enabled) { return new Connection(binding); } if (this.IsCertificateLoadPending) { this.LoadCertificate(); } return new SslConnection(this, binding); }
public static Connection Connect(String hostname, Int32 port, Binding binding) { IPAddress lHostAddress = Dns.DnsLookup.ResolveFirst(hostname); return Client.Connect(lHostAddress, port, binding); }
public static Connection Connect(IPAddress host, Int32 port, Binding binding) { Connection lConnection = new Connection(binding); lConnection.Connect(host, port); return lConnection; }
protected virtual Connection NewConnection(Binding binding) { if (this.fConnectionFactory != null) return this.fConnectionFactory.CreateClientConnection(binding); if (this.fConnectionClass != null) return (Connection)Activator.CreateInstance(this.fConnectionClass); #if FULLFRAMEWORK if (this.SslOptions.Enabled) { Connection lSslConnection = this.SslOptions.CreateClientConnection(binding); lSslConnection.EnableNagle = this.EnableNagle; return lSslConnection; } #endif Connection lConnection = new Connection(binding); lConnection.EnableNagle = this.EnableNagle; return lConnection; }
protected virtual Connection GetConnection(IPAddress host, Int32 port) { if (this.fConnectionPool != null) return this.fConnectionPool.GetConnection(new IPEndPoint(host, port)); Binding lBinding; switch (host.AddressFamily) { case AddressFamily.InterNetwork: lBinding = this.fBindingV4; break; case AddressFamily.InterNetworkV6: lBinding = this.fBindingV6; break; default: lBinding = new Binding(host.AddressFamily); break; } Connection lConnection = this.NewConnection(lBinding); lConnection.Connect(host, port); return lConnection; }
public SslConnection(SslConnectionFactory factory, Binding binding) : base((Socket)null) { fFactory = factory; fInnerConnection = new InnerConnection(binding); fInnerConnection.BufferedAsync = false; fInnerConnection.AsyncDisconnect += new EventHandler(InnerConnection_AsyncDisconnect); fInnerConnection.AsyncHaveIncompleteData += new EventHandler(InnerConnection_AsyncHaveIncompleteData); }
public virtual Connection CreateClientConnection(Binding binding) { if (!this.Enabled) return new Connection(binding); if (this.HasCertificate) this.LoadCertificate(); return new SslConnection(this, binding); }
public static Connection Connect(String hostname, Int32 port, Binding binding) { IPAddress lHostAddress = Dns.DnsLookup.ResolveFirst(hostname); return(Client.Connect(lHostAddress, port, binding)); }