Ejemplo n.º 1
0
    public async Task<bool> Connect(string host)
    {
        IPHostEntry hostEntry = null;
        hostEntry = Dns.GetHostEntry(host);

        foreach (IPAddress address in hostEntry.AddressList)
        {
            IPEndPoint ipe = new IPEndPoint(address, 6667);
            AsyncSocket temp = new AsyncSocket(ipe.AddressFamily, SocketType.Stream, ProtocolType.Unspecified);
            await temp.ConnectTaskAsync(ipe);

            if (temp.Connected)
            {
                s = temp;
                break;
            }
        }
        return s.Connected;
    }