コード例 #1
0
        public async Task ConnectAsync(string ip)
        {
            await CancelScanningAsync();

            Guid guid = await client.ConnectAsync(new HostName(ip), SHUB_PORT);

            // Connection timeout
            if (guid == default(Guid))
            {
                if (ConnectionTimeout != null)
                {
                    ConnectionTimeout(this, ip);
                }
                return;
            }

            if (NewProfile != null)
            {
                HServerInformation serverInf = client.GetServer(guid);
                TClientProfile     profile   = new TClientProfile(serverInf, serverInf.IP);
                profile.State = ConnectionState.Connected;
                NewProfile(this, profile);
            }
        }