Exemplo n.º 1
0
        public unsafe void CouldSendReceive()
        {
            var connection0 = new LocalMulticast <long>(51311, x => Console.WriteLine("0: " + x), "0");
            var connection1 = new LocalMulticast <long>(51311, x => Console.WriteLine("1: " + x), "1");
            var connection2 = new LocalMulticast <long>(51311, x => Console.WriteLine("2: " + x), "2");
            var connection3 = new LocalMulticast <long>(51311, x => Console.WriteLine("3: " + x), "3");

            connection0.StartReceive();
            Thread.Sleep(100);
            connection1.StartReceive();
            Thread.Sleep(100);
            connection2.StartReceive();
            Thread.Sleep(100);
            connection3.StartReceive();

            Thread.Sleep(100);

            connection0.Send(1);
            Thread.Sleep(100);
            connection0.Send(2);
            Thread.Sleep(100);
            connection0.Send(3);
            Thread.Sleep(100);
            connection0.Send(4);

            Thread.Sleep(1000);

            // connection0.Dispose();
        }
Exemplo n.º 2
0
 public void Run()
 {
     // Connection.StartReceive();
     while (running)
     {
         Connection.Send(43);
     }
 }