예제 #1
0
파일: Listener.cs 프로젝트: hksonngan/Xian
        internal Listener(ServerAssociationParameters parameters, StartAssociation acceptor)
        {
            ListenerInfo info = new ListenerInfo();

            info.Parameters    = parameters;
            info.StartDelegate = acceptor;

            _applications.Add(parameters.CalledAE, info);

            _ipEndPoint = parameters.LocalEndPoint;
        }
예제 #2
0
        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;
			}
        }
예제 #3
0
파일: Listener.cs 프로젝트: hksonngan/Xian
        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);
            }
        }
예제 #4
0
        internal Listener(ServerAssociationParameters parameters, StartAssociation acceptor)
        {
            ListenerInfo info = new ListenerInfo();

            info.Parameters = parameters;
            info.StartDelegate = acceptor;

            _applications.Add(parameters.CalledAE, info);

            _ipEndPoint = parameters.LocalEndPoint;
        }