Exemple #1
0
 private void button1_Click(object sender, EventArgs e)
 {
     if (textBox1.TextLength != 0)
     {
         ClientLibrary.Message message = new ClientLibrary.Message(nameTextBox.Text, textBox1.Text, DateTime.Now);
         connector.SendAsync(message);
     }
 }
Exemple #2
0
        public async Task SendAsync()
        {
            ClientConnector client = new ClientConnector(port, address);

            client.Connect();
            Message message = new Message("Abdulmueez", "Hello", DateTime.Now);

            client.SendAsync(message);
            Message value = await CheckClientOfListener();

            Assert.AreEqual(value.Msg, message.Msg);
            Assert.AreEqual(value.UserName, message.UserName);
            Assert.AreEqual(value.time, message.time);
            message.Msg += "2";
            client.SendAsync(message);
            value = await CheckClientOfListener();

            Assert.AreEqual(value.Msg, message.Msg);
            Assert.AreEqual(value.UserName, message.UserName);
            Assert.AreEqual(value.time, message.time);
        }