internal Listener(ServerAssociationParameters parameters, StartAssociation acceptor) { ListenerInfo info = new ListenerInfo(); info.Parameters = parameters; info.StartDelegate = acceptor; _applications.Add(parameters.CalledAE, info); _ipEndPoint = parameters.LocalEndPoint; }
public static bool Listen(ServerAssociationParameters parameters, StartAssociation acceptor) { lock (_syncLock) { Listener theListener; if (_listeners.TryGetValue(parameters.LocalEndPoint, out theListener)) { ListenerInfo info = new ListenerInfo(); info.StartDelegate = acceptor; info.Parameters = parameters; if (theListener._applications.ContainsKey(parameters.CalledAE)) { Platform.Log(LogLevel.Error, "Already listening with AE {0} on {1}", parameters.CalledAE, parameters.LocalEndPoint.ToString()); return false; } theListener._applications.Add(parameters.CalledAE, info); Platform.Log(LogLevel.Info, "Starting to listen with AE {0} on existing port {1}", parameters.CalledAE, parameters.LocalEndPoint.ToString()); } else { theListener = new Listener(parameters, acceptor); if (!theListener.StartListening()) { Platform.Log(LogLevel.Error, "Unexpected error starting to listen on {0}", parameters.LocalEndPoint.ToString()); return false; } _listeners[parameters.LocalEndPoint] = theListener; theListener.StartThread(); Platform.Log(LogLevel.Info, "Starting to listen with AE {0} on port {1}", parameters.CalledAE, parameters.LocalEndPoint.ToString()); } return true; } }
public static bool Listen(ServerAssociationParameters parameters, StartAssociation acceptor) { lock (_syncLock) { Listener theListener; if (_listeners.TryGetValue(parameters.LocalEndPoint, out theListener)) { ListenerInfo info = new ListenerInfo(); info.StartDelegate = acceptor; info.Parameters = parameters; if (theListener._applications.ContainsKey(parameters.CalledAE)) { Platform.Log(LogLevel.Error, "Already listening with AE {0} on {1}", parameters.CalledAE, parameters.LocalEndPoint.ToString()); return(false); } theListener._applications.Add(parameters.CalledAE, info); Platform.Log(LogLevel.Info, "Starting to listen with AE {0} on existing port {1}", parameters.CalledAE, parameters.LocalEndPoint.ToString()); } else { theListener = new Listener(parameters, acceptor); if (!theListener.StartListening()) { Platform.Log(LogLevel.Error, "Unexpected error starting to listen on {0}", parameters.LocalEndPoint.ToString()); return(false); } _listeners[parameters.LocalEndPoint] = theListener; theListener.StartThread(); Platform.Log(LogLevel.Info, "Starting to listen with AE {0} on port {1}", parameters.CalledAE, parameters.LocalEndPoint.ToString()); } return(true); } }