TcpClient.ConnectSocket C# (CSharp) Method

ConnectSocket() public method

public ConnectSocket ( string host, int port ) : void
host string
port int
return void
    public void ConnectSocket(string host, int port)
    {
        IPAddress[] ips = Dns.GetHostAddresses(host);
        IPEndPoint e = new IPEndPoint(ips[0], port);
        sock = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
        sock.BeginConnect(e, cck, this);
    }

Usage Example

Example #1
0
 public void setup()
 {
     act  = requestType.setup;
     Csep = 1;
     this.start();
     tc.ConnectSocket(_host, _port);
 }