} // StartListening /// <include file='doc\CombinedTcpChannel.uex' path='docs/doc[@for="TcpChannel.StopListening"]/*' /> public void StopListening(Object data) { if (_serverChannel != null) { _serverChannel.StopListening(data); } } // StopListening
public void Start() { try { // Register TCP Channel channel = new TcpServerChannel( "Archiver", Constants.TCPListeningPort ); System.Runtime.Remoting.Channels.ChannelServices.RegisterChannel(channel, false); // Register the SAO RemotingConfiguration.RegisterWellKnownServiceType( typeof(ArchiveServer), "ArchiveServer", WellKnownObjectMode.Singleton ); string configFileName = System.Reflection.Assembly.GetEntryAssembly().Location + ".config"; if (System.IO.File.Exists(configFileName)) { RemotingConfiguration.Configure(configFileName, false); } eventLog.WriteEntry(Strings.ArchiveServiceStarted, EventLogEntryType.Information, ArchiveServiceEventLog.ID.Information); } catch { if ( channel != null ) { channel.StopListening(null); ChannelServices.UnregisterChannel(channel); } } }
public void StopListening(object data) { if (_serverChannel != null) { _serverChannel.StopListening(data); } TcpConnectionPool.Shutdown(); }
/// <summary> /// Starts the server. /// </summary> /// <exception cref="T:System.InvalidOperationException">Server is already running.</exception> public void Start() { if (this.smsSender == null) { IDictionary hashtables = new Hashtable(); hashtables["port"] = this.networkPort; hashtables["name"] = string.Concat("SMSSenderTCPChannel", this.networkPort.ToString()); if (this.isSecured) { hashtables["secure"] = "true"; this.authModule = new AuthorizationModule(this.allowAnonymous); } TcpServerChannel tcpServerChannel = new TcpServerChannel(hashtables, null, this.authModule); SmsSender smsSender = null; ObjRef objRef = null; try { ChannelServices.RegisterChannel(tcpServerChannel, this.isSecured); try { smsSender = new SmsSender(this.portName, this.baudRate, this.timeout); objRef = RemotingServices.Marshal(smsSender, this.uri); } catch (Exception exception) { ChannelServices.UnregisterChannel(tcpServerChannel); throw; } } catch (Exception exception1) { tcpServerChannel.StopListening(null); throw; } this.channel = tcpServerChannel; this.smsSender = smsSender; this.objRefSmsSender = objRef; this.ConnectEvents(); return; } else { throw new InvalidOperationException("Server is already running."); } }