public bool Connect(string host, int port) { hs = new HostStruct(); hs.host = host; hs.port = port; state = SocketState.HANDSHAKING; try { IPEndPoint ipEnd = new IPEndPoint(proxy.ip, proxy.port); Socket client = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp); clientSocket = client; client.BeginConnect(ipEnd, new AsyncCallback(ConnectCallback), hs); } catch (Exception e) { Console.WriteLine(e.ToString()); } return(isConnected); }
public bool Connect(string host, int port) { hs = new HostStruct(); hs.host = host; hs.port = port; state = SocketState.HANDSHAKING; try { IPEndPoint ipEnd = new IPEndPoint(proxy.ip, proxy.port); Socket client = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp); clientSocket = client; client.BeginConnect(ipEnd, new AsyncCallback(ConnectCallback), hs); } catch (Exception e) { Console.WriteLine(e.ToString()); } return isConnected; }