public override void Connect() { if (this.m_InConnecting) { throw new Exception("The socket is connecting, cannot connect again!"); } if (this.Client != null) { throw new Exception("The socket is connected, you needn't connect again!"); } if (this.Proxy != null) { this.Proxy.Completed += new EventHandler <ProxyEventArgs>(this.Proxy_Completed); this.Proxy.Connect(this.RemoteEndPoint); this.m_InConnecting = true; } else { this.m_InConnecting = true; ConnectAsyncExtension.ConnectAsync(this.RemoteEndPoint, new ConnectedCallback(this.ProcessConnect), (object)null); } }