public void StartListening(Action <_TClientContext> connectionHandler) { using (EneterTrace.Entering()) { try { using (ThreadLock.Lock(myListeningManipulatorLock)) { if (IsListening) { string aMessage = TracedObject + ErrorHandler.IsAlreadyListening; EneterTrace.Error(aMessage); throw new InvalidOperationException(aMessage); } if (connectionHandler == null) { throw new ArgumentNullException("The input parameter connectionHandler is null."); } myConnectionHandler = connectionHandler; HostListenerController.StartListening(Address, myHostListenerFactory, myConnectionHandler, mySecurityFactory); } } catch (Exception err) { EneterTrace.Error(TracedObject + ErrorHandler.FailedToStartListening, err); throw; } } }
public void StopListening() { using (EneterTrace.Entering()) { try { using (ThreadLock.Lock(myListeningManipulatorLock)) { HostListenerController.StopListening(Address); myConnectionHandler = null; } } catch (Exception err) { EneterTrace.Warning(TracedObject + ErrorHandler.IncorrectlyStoppedListening, err); } } }