Exemplo n.º 1
0
        /// <summary> Starts accepting connections in a new Thread.  Note that this can be
        /// called multiple times with separate addresses.  The stop() method ends
        /// all Threads started here.
        ///
        /// </summary>
        /// <param name="theAddress">IP address from which connections are accepted (null
        /// means any address is OK)
        /// </param>
        public virtual void  start(System.String theAddress)
        {
            NuGenHL7Server  server   = this;
            IThreadRunnable acceptor = new AnonymousClassRunnable(server, theAddress, this);

            myIsRunning = true;

            SupportClass.ThreadClass thd = new SupportClass.ThreadClass(new System.Threading.ThreadStart(acceptor.Run));
            thd.Start();
        }
Exemplo n.º 2
0
			public AnonymousClassRunnable(Genetibase.NuGenHL7.protocol.impl.NuGenHL7Server server, System.String theAddress, NuGenHL7Server enclosingInstance)
			{
				InitBlock(server, theAddress, enclosingInstance);
			}
Exemplo n.º 3
0
			private void  InitBlock(System.Collections.IList processors, NuGenHL7Server enclosingInstance)
			{
				this.processors = processors;
				this.enclosingInstance = enclosingInstance;
			}
Exemplo n.º 4
0
			public AnonymousClassThread(System.Collections.IList processors, NuGenHL7Server enclosingInstance)
			{
				InitBlock(processors, enclosingInstance);
			}
Exemplo n.º 5
0
		public static void  Main(System.String[] args)
		{
			if (args.Length < 1 || args.Length > 3)
			{
				System.Console.Out.WriteLine("Usage: HL7Server (shared_port | (locally_driven_port remotely_driven_port)) app_binding_URL");
				System.Environment.Exit(1);
			}
			
			NuGenSafeStorage storage = new NuGenNullSafeStorage();
			NuGenApplicationRouter router = new NuGenApplicationRouterImpl();
			
			try
			{
				NuGenHL7Server server = null;
				System.String appURL = null;
				if (args.Length == 2)
				{
					int port = System.Int32.Parse(args[0]);
					System.Net.Sockets.TcpListener temp_tcpListener;
					temp_tcpListener = new System.Net.Sockets.TcpListener(System.Net.Dns.GetHostEntry(System.Net.Dns.GetHostName()).AddressList[0], port);
					temp_tcpListener.Start();
					server = new NuGenHL7Server(temp_tcpListener, router, storage);
					appURL = args[1];
				}
				else
				{
					int localPort = System.Int32.Parse(args[0]);
					int remotePort = System.Int32.Parse(args[1]);
					System.Net.Sockets.TcpListener temp_tcpListener2;
					temp_tcpListener2 = new System.Net.Sockets.TcpListener(System.Net.Dns.GetHostEntry(System.Net.Dns.GetHostName()).AddressList[0], localPort);
					temp_tcpListener2.Start();
					System.Net.Sockets.TcpListener temp_tcpListener3;
					temp_tcpListener3 = new System.Net.Sockets.TcpListener(System.Net.Dns.GetHostEntry(System.Net.Dns.GetHostName()).AddressList[0], remotePort);
					temp_tcpListener3.Start();
					server = new NuGenHL7Server(temp_tcpListener2, temp_tcpListener3, router, storage);
					appURL = args[2];
				}
				
				NuGenApplicationLoader.loadApplications(router, getURL(appURL));
				
				server.start(null); //any address OK            
			}
			catch (System.FormatException)
			{
				System.Console.Out.WriteLine("Port arguments must be integers");
				System.Environment.Exit(2);
			}
			catch (System.IO.IOException e)
			{
				SupportClass.WriteStackTrace(e, Console.Error);
				System.Environment.Exit(3);
			}
			catch (NuGenHL7Exception e)
			{
				SupportClass.WriteStackTrace(e, Console.Error);
				System.Environment.Exit(4);
			}
			catch (System.UnauthorizedAccessException e)
			{
				SupportClass.WriteStackTrace(e, Console.Error);
				System.Environment.Exit(7);
			}
		}
Exemplo n.º 6
0
			private void  InitBlock(Genetibase.NuGenHL7.protocol.impl.NuGenHL7Server server, System.String theAddress, NuGenHL7Server enclosingInstance)
			{
				this.server = server;
				this.theAddress = theAddress;
				this.enclosingInstance = enclosingInstance;
			}
Exemplo n.º 7
0
 public AnonymousClassRunnable(Genetibase.NuGenHL7.protocol.impl.NuGenHL7Server server, System.String theAddress, NuGenHL7Server enclosingInstance)
 {
     InitBlock(server, theAddress, enclosingInstance);
 }
Exemplo n.º 8
0
 private void  InitBlock(System.Collections.IList processors, NuGenHL7Server enclosingInstance)
 {
     this.processors        = processors;
     this.enclosingInstance = enclosingInstance;
 }
Exemplo n.º 9
0
 public AnonymousClassThread(System.Collections.IList processors, NuGenHL7Server enclosingInstance)
 {
     InitBlock(processors, enclosingInstance);
 }
Exemplo n.º 10
0
        public static void  Main(System.String[] args)
        {
            if (args.Length < 1 || args.Length > 3)
            {
                System.Console.Out.WriteLine("Usage: HL7Server (shared_port | (locally_driven_port remotely_driven_port)) app_binding_URL");
                System.Environment.Exit(1);
            }

            NuGenSafeStorage       storage = new NuGenNullSafeStorage();
            NuGenApplicationRouter router  = new NuGenApplicationRouterImpl();

            try
            {
                NuGenHL7Server server = null;
                System.String  appURL = null;
                if (args.Length == 2)
                {
                    int port = System.Int32.Parse(args[0]);
                    System.Net.Sockets.TcpListener temp_tcpListener;
                    temp_tcpListener = new System.Net.Sockets.TcpListener(System.Net.Dns.GetHostEntry(System.Net.Dns.GetHostName()).AddressList[0], port);
                    temp_tcpListener.Start();
                    server = new NuGenHL7Server(temp_tcpListener, router, storage);
                    appURL = args[1];
                }
                else
                {
                    int localPort  = System.Int32.Parse(args[0]);
                    int remotePort = System.Int32.Parse(args[1]);
                    System.Net.Sockets.TcpListener temp_tcpListener2;
                    temp_tcpListener2 = new System.Net.Sockets.TcpListener(System.Net.Dns.GetHostEntry(System.Net.Dns.GetHostName()).AddressList[0], localPort);
                    temp_tcpListener2.Start();
                    System.Net.Sockets.TcpListener temp_tcpListener3;
                    temp_tcpListener3 = new System.Net.Sockets.TcpListener(System.Net.Dns.GetHostEntry(System.Net.Dns.GetHostName()).AddressList[0], remotePort);
                    temp_tcpListener3.Start();
                    server = new NuGenHL7Server(temp_tcpListener2, temp_tcpListener3, router, storage);
                    appURL = args[2];
                }

                NuGenApplicationLoader.loadApplications(router, getURL(appURL));

                server.start(null);                 //any address OK
            }
            catch (System.FormatException)
            {
                System.Console.Out.WriteLine("Port arguments must be integers");
                System.Environment.Exit(2);
            }
            catch (System.IO.IOException e)
            {
                SupportClass.WriteStackTrace(e, Console.Error);
                System.Environment.Exit(3);
            }
            catch (NuGenHL7Exception e)
            {
                SupportClass.WriteStackTrace(e, Console.Error);
                System.Environment.Exit(4);
            }
            catch (System.UnauthorizedAccessException e)
            {
                SupportClass.WriteStackTrace(e, Console.Error);
                System.Environment.Exit(7);
            }
        }
Exemplo n.º 11
0
 private void  InitBlock(Genetibase.NuGenHL7.protocol.impl.NuGenHL7Server server, System.String theAddress, NuGenHL7Server enclosingInstance)
 {
     this.server            = server;
     this.theAddress        = theAddress;
     this.enclosingInstance = enclosingInstance;
 }