public ParticipantChangedEventArgs(RtpCommunicator communicator, Multicast multicast, Participant participant, ParticipantChangedType type) { this.Communicator = communicator; this.Multicast = multicast; this.Participant = participant; this.Type = type; }
/// <summary> /// 安装模块 /// </summary> /// <param name="context"></param> public void Install(RtpCommunicator communicator) { if (this.Installed) { return; } this.Installed = true; this.Communicator = communicator; _channel = CreateChannel(communicator); InstallImpl(communicator); _events.Raise(communicator, this, true); }
/// <summary> /// 移除模块 /// </summary> /// <param name="context"></param> public void Uninstall(RtpCommunicator communicator) { if (!this.Installed) { return; } this.Installed = false; UninstallImpl(communicator); LogoutCapabilities(); RemoveChannel(communicator); _channel = null; this.Communicator = null; _events.Raise(communicator, this, false); }
private void InitializeCommunicator(string serverIP, int serverPort) { var config = new ClientConfig() { Host = serverIP, Port = serverPort, ReconnectDelayTime = 5, //间隔5秒重连一次 ReconnectTimes = 0 //无限重连 }; _communicator = new RtpCommunicator(this.CommunicatorName, config); _communicator.Connected += OnConnected; _communicator.Error += OnError; _communicator.LastConnectError += OnLastConnectError; _communicator.Dropped += OnDropped; _communicator.Start(); _single = new AutoResetEvent(false); _single.WaitOne(); //使用信号量来控制连接是同步的,当成功连接或者失败连接后,池才会返回对象给外界使用 }
protected abstract void RemoveChannel(RtpCommunicator communicator);
protected abstract RtpChannel CreateChannel(RtpCommunicator communicator);
/// <summary> /// 卸载模块的实现方法 /// </summary> /// <param name="context"></param> protected abstract void UninstallImpl(RtpCommunicator communicator);
protected override void RemoveChannel(RtpCommunicator communicator) { communicator.Context.RemoveChannel(this.MulticastAddress); }
protected override RtpChannel CreateChannel(RtpCommunicator communicator) { return(communicator.Context.CreateChannel(this.MulticastAddress, this.Participant)); }
public ModuleChangedEventArgs(RtpCommunicator communicator, RtpModule module, bool installed) { this.Communicator = communicator; this.Module = module; this.Installed = installed; }
private void DisposeCommunicator() { _communicator.Dispose(); _communicator = null; }
protected override void RemoveChannel(RtpCommunicator communicator) { }
protected override RtpChannel CreateChannel(RtpCommunicator communicator) { return(communicator.Context.UnicastChannel); }