Пример #1
0
        public void On(JoinCompleteEvent e)
        {
            var bp = new ByteProtocol <Player>(this._byteChannel);
            var cc = new ChatChannel(new CompressionChannel <Player>(bp.RegisterProtocol("EE Chat")));

            ThreadPool.QueueUserWorkItem(o =>
            {
                while (true)
                {
                    cc.Send(Console.ReadLine());
                }
            });

            cc.Receive += this.Cc_Receive;
        }
Пример #2
0
        public void On(JoinCompleteEvent e)
        {
            var bp = new ByteProtocol<Player>(this._byteChannel);
            var cc = new ChatChannel(new CompressionChannel<Player>(bp.RegisterProtocol("EE Chat")));

            ThreadPool.QueueUserWorkItem(o =>
            {
                while (true)
                {
                    cc.Send(Console.ReadLine());
                }
            });

            cc.Receive += this.Cc_Receive;
        }
Пример #3
0
 public void On(JoinCompleteEvent e)
 {
     this._byteChannel = new ByteChannel<Player>(new CoinChannel());
     var bp = new ByteProtocol<Player>(this._byteChannel);
     var up = new UserProtocol<Player>(bp.RegisterProtocol("ByetUserStreams.Demo"), p => (uint)p.UserId);
     var stream = new ByteStream(up.GetUserChannel(this.Players.OwnPlayer, this.Players.OwnPlayer));
     {
         var writer = new StreamWriter(stream) {AutoFlush = true};
         writer.Write("Hello world!\n");
         var reader = new StreamReader(stream);
         ThreadPool.QueueUserWorkItem(o =>
         {
             while (true)
             {
                 Console.Write((char) reader.Read());
             }
         });
     }
 }
Пример #4
0
 public void On(JoinCompleteEvent e)
 {
     this._byteChannel = new ByteChannel <Player>(new CoinChannel());
     var bp     = new ByteProtocol <Player>(this._byteChannel);
     var up     = new UserProtocol <Player>(bp.RegisterProtocol("ByetUserStreams.Demo"), p => (uint)p.UserId);
     var stream = new ByteStream(up.GetUserChannel(this.Players.OwnPlayer, this.Players.OwnPlayer));
     {
         var writer = new StreamWriter(stream)
         {
             AutoFlush = true
         };
         writer.Write("Hello world!\n");
         var reader = new StreamReader(stream);
         ThreadPool.QueueUserWorkItem(o =>
         {
             while (true)
             {
                 Console.Write((char)reader.Read());
             }
         });
     }
 }