Example #1
0
        private void Form1_Load(object sender, EventArgs e)
        {
            var source = new BindingSource();

            source.DataSource        = connector.messages;
            dataGridView1.DataSource = source;
            connector.ReceiveMessage(tokenSource.Token);
        }
        public async Task TestReceiveAsync()
        {
            ClientConnector client = new ClientConnector(port, address);

            client.Connect();
            CancellationTokenSource source = new CancellationTokenSource();

            SendToClientOfListener();
            client.ReceiveMessage(source.Token);
            Thread.Sleep(10000);
            source.Cancel();
        }