/// <summary> /// Starts negotiating asynchronously with a SOCKS proxy server. /// </summary> /// <param name="remoteEndPoint">An IPEndPoint that represents the remote device.</param> /// <param name="callback">The method to call when the connection has been established.</param> /// <param name="proxyEndPoint">The IPEndPoint of the SOCKS proxy server.</param> /// <returns>An IAsyncProxyResult that references the asynchronous connection.</returns> public override AsyncSocksResult BeginNegotiate(IPEndPoint remoteEndPoint, HandShakeComplete callback, IPEndPoint proxyEndPoint) { handShakeComplete = callback; Buffer = GetEndPointBytes(remoteEndPoint); Server.BeginConnect(proxyEndPoint, OnConnect, Server); AsyncResult = new AsyncSocksResult(); return(AsyncResult); }
/// <summary> /// Starts negotiating asynchronously with a SOCKS proxy server. /// </summary> /// <param name="host">The remote server to connect to.</param> /// <param name="port">The remote port to connect to.</param> /// <param name="callback">The method to call when the connection has been established.</param> /// <param name="proxyEndPoint">The IPEndPoint of the SOCKS proxy server.</param> /// <returns>An IAsyncProxyResult that references the asynchronous connection.</returns> public override AsyncSocksResult BeginNegotiate(string host, int port, HandShakeComplete callback, IPEndPoint proxyEndPoint) { handShakeComplete = callback; Buffer = GetHostPortBytes(host, port); Server.BeginConnect(proxyEndPoint, OnConnect, Server); AsyncResult = new AsyncSocksResult(); return(AsyncResult); }