Ejemplo n.º 1
0
        public async Task StartPushing()
        {
            var message = string.Format("Id = {0}", _id);
            var bytes   = Encoding.ASCII.GetBytes(message);

            while (true)
            {
                socket.SendFrame(message);
                Console.WriteLine(" {0} Sent message", _id);
                //await Task.Delay(_id * 10);

                string fromServerMessage = socket.ReceiveFrameString();
                Console.WriteLine("Client {0} From Server: {1}", _id, fromServerMessage);
                if (!fromServerMessage.Contains(_id.ToString()))
                {
                    throw new InvalidOperationException(string.Format("{0} Received {1}", _id, fromServerMessage));
                }
            }
        }