Beispiel #1
0
        public static void Main()
        {
            var config = new MeepoConfig
            {
                BufferSizeInBytes = 1000,
                Logger            = new ConsoleLogger()
            };

            var address         = new TcpAddress(IPAddress.Loopback, 9201);
            var serverAddresses = new[] { new TcpAddress(IPAddress.Loopback, 9200) };

            using (meepoNode = new MeepoNode(address, serverAddresses, config))
            {
                meepoNode.Start();

                meepoNode.MessageReceived += OnMessageReceived;

                while (true)
                {
                    var text = System.Console.ReadLine();

                    if (text.ToLower() == "q")
                    {
                        return;
                    }

                    meepoNode.SendAsync(text).Wait();
                }
            }
        }
Beispiel #2
0
 /// <summary>
 /// Send string to all nodes.
 /// </summary>
 /// <param name="meepoNode">Server instance</param>
 /// <param name="id">Client ID</param>
 /// <param name="message">Message to send</param>
 public static Task SendAsync(this IMeepoNode meepoNode, Guid id, string message)
 {
     return(meepoNode.SendAsync(id, Encode(message)));
 }