Example #1
0
        public static void  Main(System.String[] args)
        {
            if (args.Length != 2)
            {
                System.Console.Out.WriteLine("Usage: Genetibase.NuGenHL7.app.Initiator host port");
            }

            try
            {
                //set up connection to server
                System.String host = args[0];
                int           port = System.Int32.Parse(args[1]);

                Parser             parser     = new PipeParser();
                LowerLayerProtocol llp        = LowerLayerProtocol.makeLLP();
                NuGenConnection    connection = new NuGenConnection(parser, llp, new System.Net.Sockets.TcpClient(host, port));
                NuGenInitiator     initiator  = connection.Initiator;
                System.String      outText    = "MSH|^~\\&|||||||ACK^^ACK|||R|2.4|\rMSA|AA";

                //get a bunch of threads to send messages
                for (int i = 0; i < 1000; i++)
                {
                    SupportClass.ThreadClass sender = new SupportClass.ThreadClass(new System.Threading.ThreadStart(new AnonymousClassRunnable(parser, outText, initiator).Run));
                    sender.Start();
                }
            }
            catch (System.Exception e)
            {
                SupportClass.WriteStackTrace(e, Console.Error);
            }
        }
Example #2
0
        /// <summary> Creates a new instance of Connection, with inbound and outbound
        /// communication on a single port.
        /// </summary>
        public NuGenConnection(Parser parser, LowerLayerProtocol llp, System.Net.Sockets.TcpClient bidirectional)
        {
            init(parser);
            ackWriter  = llp.getWriter(bidirectional.GetStream());
            sendWriter = ackWriter;
            sockets.Add(bidirectional);
            NuGenReceiver r = new NuGenReceiver(this, llp.getReader(bidirectional.GetStream()));

            r.start();
            receivers.Add(r);
            this.initiator = new NuGenInitiator(this);
        }
Example #3
0
        /// <summary> Creates a new instance of Connection, with inbound communication on one
        /// port and outbound on another.
        /// </summary>
        public NuGenConnection(Parser parser, LowerLayerProtocol llp, System.Net.Sockets.TcpClient inbound, System.Net.Sockets.TcpClient outbound)
        {
            init(parser);
            ackWriter  = llp.getWriter(inbound.GetStream());
            sendWriter = llp.getWriter(outbound.GetStream());
            sockets.Add(outbound);             //always add outbound first ... see getRemoteAddress()
            sockets.Add(inbound);
            NuGenReceiver inRec  = new NuGenReceiver(this, llp.getReader(inbound.GetStream()));
            NuGenReceiver outRec = new NuGenReceiver(this, llp.getReader(outbound.GetStream()));

            inRec.start();
            outRec.start();
            receivers.Add(inRec);
            receivers.Add(outRec);
            this.initiator = new NuGenInitiator(this);
        }
		/// <summary> Creates a new instance of Connection, with inbound communication on one 
		/// port and outbound on another.
		/// </summary>
		public NuGenConnection(Parser parser, LowerLayerProtocol llp, System.Net.Sockets.TcpClient inbound, System.Net.Sockets.TcpClient outbound)
		{
			init(parser);
			ackWriter = llp.getWriter(inbound.GetStream());
			sendWriter = llp.getWriter(outbound.GetStream());
			sockets.Add(outbound); //always add outbound first ... see getRemoteAddress()
			sockets.Add(inbound);
			NuGenReceiver inRec = new NuGenReceiver(this, llp.getReader(inbound.GetStream()));
			NuGenReceiver outRec = new NuGenReceiver(this, llp.getReader(outbound.GetStream()));
			inRec.start();
			outRec.start();
			receivers.Add(inRec);
			receivers.Add(outRec);
			this.initiator = new NuGenInitiator(this);
		}
		/// <summary> Creates a new instance of Connection, with inbound and outbound 
		/// communication on a single port. 
		/// </summary>
		public NuGenConnection(Parser parser, LowerLayerProtocol llp, System.Net.Sockets.TcpClient bidirectional)
		{
			init(parser);
			ackWriter = llp.getWriter(bidirectional.GetStream());
			sendWriter = ackWriter;
			sockets.Add(bidirectional);
			NuGenReceiver r = new NuGenReceiver(this, llp.getReader(bidirectional.GetStream()));
			r.start();
			receivers.Add(r);
			this.initiator = new NuGenInitiator(this);
		}