예제 #1
0
    public static void Main(String[] args)
    {
        // Configure a logger to capture the output of the library
        Tracer.Trace = new ConsoleLogger();

        try
        {
            // Send some messages for each selector
            Selectors
            .ForEach(x => Send(x, 20));

            // Receive the messages
            var consumers = Selectors
                            .Select(Receive)
                            .ToList();

            // Wait before disposing the consumers
            Thread.Sleep(10000);
            consumers.ForEach(x => x.Dispose());
        }
        catch (Exception ex)
        {
            Console.WriteLine($"Error: {ex}");
        }

        Console.WriteLine("Press <enter> to exit.");
        Console.ReadLine();
    }