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


C# Joint.Start方法代码示例

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


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

示例1: ReadDataAsync


//.........这里部分代码省略.........
                        case SIGNAL_CONNECT_PROXY_TUNNEL:
                            {
                                ChannelStream remoteChannel1 = null;
                                Stream remoteChannel2 = null;

                                try
                                {
                                    //get remote peer ep
                                    IPEndPoint tunnelToPeerEP = ConvertToIP(channelName.ID);

                                    //add first stream into list
                                    remoteChannel1 = new ChannelStream(this, channelName, ChannelType.ProxyTunnel);

                                    lock (_proxyTunnelChannels)
                                    {
                                        _proxyTunnelChannels.Add(channelName, remoteChannel1);
                                    }

                                    //get remote channel service
                                    Connection remotePeerConnection = _connectionManager.GetExistingConnection(tunnelToPeerEP);

                                    //get remote stream for virtual connection
                                    remoteChannel2 = remotePeerConnection.RequestVirtualConnectionChannel(_remotePeerEP);

                                    //join current and remote stream
                                    Joint joint = new Joint(remoteChannel1, remoteChannel2);
                                    joint.Disposed += joint_Disposed;

                                    lock (_tunnelJointList)
                                    {
                                        _tunnelJointList.Add(joint);
                                    }

                                    joint.Start();

                                    Debug.Write("Connection.ReadDataAsync", "SIGNAL_CONNECT_PROXY_TUNNEL; tunnel to peerIP: " + tunnelToPeerEP.ToString());
                                }
                                catch
                                {
                                    if (remoteChannel1 != null)
                                        remoteChannel1.Dispose();

                                    if (remoteChannel2 != null)
                                        remoteChannel2.Dispose();
                                }
                            }
                            break;

                        case SIGNAL_DISCONNECT_PROXY_TUNNEL:
                            try
                            {
                                lock (_proxyTunnelChannels)
                                {
                                    _proxyTunnelChannels[channelName].Dispose();
                                }

                                Debug.Write("Connection.ReadDataAsync", "SIGNAL_DISCONNECT_PROXY_TUNNEL; channel: " + channelName.ToString());
                            }
                            catch
                            { }
                            break;

                        case SIGNAL_CONNECT_VIRTUAL_CONNECTION:
                            {
                                ChannelStream channel = null;
开发者ID:rodoviario,项目名称:BitChatClient,代码行数:66,代码来源:Connection.cs


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