override public void  Run()
 {
     myException = null;
     try
     {
         myTransport.connect();
     }
     catch (NuGenTransportException e)
     {
         myException = e;
     }
 }
Пример #2
0
 /// <summary> Tries to send the message, and if there is an error reconnects and tries again. </summary>
 private void  trySend(NuGenTransportLayer theTransport, NuGenTransportable theTransportable)
 {
     try
     {
         theTransport.send(theTransportable);
     }
     catch (NuGenTransportException)
     {
         theTransport.disconnect();
         theTransport.connect();
         theTransport.send(theTransportable);
     }
 }
Пример #3
0
        /// <summary> Tries to receive a message, and if there is an error reconnects and tries again. </summary>
        private NuGenTransportable tryReceive(NuGenTransportLayer theTransport)
        {
            NuGenTransportable message = null;

            try
            {
                message = theTransport.receive();
            }
            catch (NuGenTransportException)
            {
                theTransport.disconnect();
                theTransport.connect();
                message = theTransport.receive();
            }
            return(message);
        }
Пример #4
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));
        }