예제 #1
0
        /// <summary> Accepts a single inbound connection if the same ServerSocket is used for
        /// all message exchanges, or a connection from each if two ServerSockets are
        /// being used.
        ///
        /// </summary>
        /// <param name="theAddress">the IP address from which to accept connections (null means
        /// accept from any address).  Connection attempts from other addresses will
        /// be ignored.
        /// </param>
        /// <returns> a <code>Processor</code> connected to the given address
        /// </returns>
        /// <throws>  TransportException </throws>
        public virtual NuGenProcessor accept(System.String theAddress)
        {
            NuGenTransportLayer   transport = getTransport(myServerSocket, theAddress);
            NuGenProcessorContext context   = null;

            if (myServerSocket2 == null)
            {
                //we're doing inbound & outbound on the same port
                transport.connect();
                context = new NuGenProcessorContextImpl(myRouter, transport, myStorage);
            }
            else
            {
                NuGenTransportLayer         transport2 = getTransport(myServerSocket2, theAddress);
                NuGenDualTransportConnector connector  = new NuGenDualTransportConnector(transport, transport2);
                connector.connect();

                context = new NuGenProcessorContextImpl(myRouter, transport, transport2, myStorage);
            }
            return(new NuGenProcessorImpl(context, true));
        }
예제 #2
0
		/// <summary> Accepts a single inbound connection if the same ServerSocket is used for 
		/// all message exchanges, or a connection from each if two ServerSockets are 
		/// being used. 
		/// 
		/// </summary>
		/// <param name="theAddress">the IP address from which to accept connections (null means 
		/// accept from any address).  Connection attempts from other addresses will 
		/// be ignored.  
		/// </param>
		/// <returns> a <code>Processor</code> connected to the given address  
		/// </returns>
		/// <throws>  TransportException </throws>
		public virtual NuGenProcessor accept(System.String theAddress)
		{
			NuGenTransportLayer transport = getTransport(myServerSocket, theAddress);
			NuGenProcessorContext context = null;
			
			if (myServerSocket2 == null)
			{
				//we're doing inbound & outbound on the same port
				transport.connect();
				context = new NuGenProcessorContextImpl(myRouter, transport, myStorage);
			}
			else
			{
				NuGenTransportLayer transport2 = getTransport(myServerSocket2, theAddress);
				NuGenDualTransportConnector connector = new NuGenDualTransportConnector(transport, transport2);
				connector.connect();
				
				context = new NuGenProcessorContextImpl(myRouter, transport, transport2, myStorage);
			}
			return new NuGenProcessorImpl(context, true);
		}