Beispiel #1
0
        public async Task StartAsync(string address, ushort port, string password, string name)
        {
            Debug.Assert(!Running);
            Debug.Assert(port > 0);
            Debug.Assert(address != null);

            Client = new SimpleSocketClient <SocketData>();

            if (!string.IsNullOrEmpty(password))
            {
                Client.SetPassword(password);
            }
            await Client.StartAsync(address, port);

            try
            {
                await CheckAsync(name);
            }
            catch
            {
                Client.Close();
                throw;
            }
            Client.Session.ReceivedData += Session_ReceivedData;
            Running = true;
        }