当前位置: 首页>>代码示例>>C#>>正文


C# Client.OpenSessionChannel方法代码示例

本文整理汇总了C#中Client.OpenSessionChannel方法的典型用法代码示例。如果您正苦于以下问题:C# Client.OpenSessionChannel方法的具体用法?C# Client.OpenSessionChannel怎么用?C# Client.OpenSessionChannel使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Client的用法示例。


在下文中一共展示了Client.OpenSessionChannel方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: ClienteGT

        public ClienteGT(string host, string port)
        {
            // this.form = f;

            // Set up GT
            client = new Client(new DefaultClientConfiguration());
            client.ErrorEvent += es => Console.WriteLine(es);
            // client.ErrorEvent += es => MessageBox.Show(es.ToString());

            // Evento do client
            client.ConnexionRemoved += client_ConnexionRemoved;
            client.Start();

            // Evento do client
            client.MessageSent += new MessageHandler(this.MensagemEnviada);

            // updates: controle de acesso à sessão
            updates = client.OpenSessionChannel(host, port, SessionUpdatesChannelId, ChannelDeliveryRequirements.SessionLike);

            // Evento do updates
            updates.MessagesReceived += updates_SessionMessagesReceived;

            // Utilizar o OpenObjectChannel para enviar objetos genéricos
            objts = client.OpenObjectChannel(host, port, ObjectChannelId, ChannelDeliveryRequirements.CommandsLike);

            objts.MessagesReceived += new Action<IObjectChannel>(objts_MessagesReceived);
        }
开发者ID:pichiliani,项目名称:CoMusic,代码行数:27,代码来源:ClienteGT.cs

示例2: Form1

        public Form1()
        {
            InputDialog d = new InputDialog("Connection details", "Which server:port ?", "localhost:9999");
            if (d.ShowDialog() != DialogResult.OK)
            {
                throw new InvalidOperationException();
            }
            string[] parts = d.Input.Split(':');
            string host = parts[0];
            string port = parts.Length > 1 ? parts[1] : "9999";

            client = new Client();
            client.ConnexionRemoved += client_ConnexionRemoved;
            client.Start();
            chats = client.OpenStringChannel(host, port, ChatMessagesChannelId, ChannelDeliveryRequirements.ChatLike);
            updates = client.OpenSessionChannel(host, port, SessionUpdatesChannelId, ChannelDeliveryRequirements.SessionLike);
            InitializeComponent();
            this.Disposed += Form1_Disposed;
        }
开发者ID:pichiliani,项目名称:CoMusic,代码行数:19,代码来源:Form1.cs

示例3: Run

        private void Run()
        {
            // set PingInterval to ridiculous value so that pings are under
            // our manual control
            configuration.PingInterval = TimeSpan.FromDays(10);
            Client client = new Client(configuration);
            client.ConnexionAdded += _client_ConnexionAdded;
            client.Start();

            ISessionChannel channel = client.OpenSessionChannel(host, port, 0,
                ChannelDeliveryRequirements.SessionLike);

            for(int iter = 0; iter < numPings; iter++)
            {
                Stopwatch sw = Stopwatch.StartNew();
                foreach(IConnexion cnx in client.Connexions)
                {
                    ((BaseConnexion)cnx).Ping();
                }
                while(sw.Elapsed.CompareTo(DelayTime) < 0)
                {
                    client.Update();
                    client.Sleep(TimeSpan.FromMilliseconds(1));
                }
            }
            ReportResults();
        }
开发者ID:briandealwis,项目名称:gt,代码行数:27,代码来源:PingClient.cs

示例4: Form1_Load

        private void Form1_Load(object sender, EventArgs e)
        {
            InputDialog d = new InputDialog("Connection details", "Which server:port ?", "localhost:9999");
            if (d.ShowDialog() != DialogResult.OK)
            {
                throw new InvalidOperationException();
            }
            string[] parts = d.Input.Split(':');
            string host = parts[0];
            string port = parts.Length > 1 ? parts[1] : "9999";

            // Set up GT
            client = new Client(new DefaultClientConfiguration());
            client.ErrorEvent += es => Console.WriteLine(es);
            client.ConnexionRemoved += client_ConnexionRemoved;
            client.Start();

            updates = client.OpenSessionChannel(host, port, SessionUpdatesChannelId,
                ChannelDeliveryRequirements.SessionLike);
            updates.MessagesReceived += updates_SessionMessagesReceived;

            coords = client.OpenStreamedTuple<int, int>(host, port, TelepointersChannelId,
                TimeSpan.FromMilliseconds(50),
                ChannelDeliveryRequirements.AwarenessLike);
            coords.StreamedTupleReceived += coords_StreamedTupleReceived;
        }
开发者ID:briandealwis,项目名称:gt,代码行数:26,代码来源:Form1.cs

示例5: Form1_Load

        private void Form1_Load(object sender, EventArgs e)
        {
            InputDialog d = new InputDialog("Connection details", "Which server:port ?", "localhost:9999");
            if (d.ShowDialog() != DialogResult.OK)
            {
                throw new InvalidOperationException();
            }
            string[] parts = d.Input.Split(':');
            string host = parts[0];
            string port = parts.Length > 1 ? parts[1] : "9999";

            // Aqui vou colocar a chamada para o cliente GT!
            // cGT = new ClienteGT(host, port);

            // Set up GT
            client = new Client(new DefaultClientConfiguration());
            client.ErrorEvent += es => Console.WriteLine(es);

            // Evento do client
            client.ConnexionRemoved += client_ConnexionRemoved;
            client.Start();

            // Evento do client
            client.MessageSent += new MessageHandler(this.MensagemEnviada);

            updates = client.OpenSessionChannel(host, port, SessionUpdatesChannelId,
                ChannelDeliveryRequirements.SessionLike);

            // Evento do updates
            updates.MessagesReceived += updates_SessionMessagesReceived;

            // coords armazena os dados recebidos (é a tupla)
               // coords = client.OpenStreamedTuple<int, int>(host, port, TelepointersChannelId,
               //     TimeSpan.FromMilliseconds(50),
               //     ChannelDeliveryRequirements.AwarenessLike);

            coords = client.OpenStreamedTuple<int, int>(host, port, TelepointersChannelId,
                TimeSpan.FromMilliseconds(50),
                ChannelDeliveryRequirements.AwarenessLike);

            // Evento do coords
            coords.StreamedTupleReceived += coords_StreamedTupleReceived;

            // coords.Identity

            // Utilizar o OpenObjectChannel para enviar um objeto ao invés de enviar uma tupla
            // objts = client.OpenObjectChannel(host, port, ObjectChannelId, ChannelDeliveryRequirements.AwarenessLike);
            objts = client.OpenObjectChannel(host, port, ObjectChannelId, ChannelDeliveryRequirements.CommandsLike);

            objts.MessagesReceived += new Action<IObjectChannel>(objts_MessagesReceived);
        }
开发者ID:pichiliani,项目名称:CoMusic,代码行数:51,代码来源:Form1.cs


注:本文中的Client.OpenSessionChannel方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。