/// <summary>
		/// The real workhorse handling incoming requests, dispatching them and
		/// sending back replies.
		/// </summary>
		/// <remarks>
		/// The real workhorse handling incoming requests, dispatching them and
		/// sending back replies.
		/// </remarks>
		public virtual void _listen()
		{
			OncRpcCallInformation callInfo = new OncRpcCallInformation
				(this);
			for (; ; )
			{
				//
				// Start decoding the incomming call. This involves remembering
				// from whom we received the call so we can later send back the
				// appropriate reply message.
				// Note that for UDP-based communication we don't need to deal
				// with timeouts.
				//
				try
				{
					pendingDecoding = true;
					receivingXdr.beginDecoding();
					callInfo.peerAddress = receivingXdr.getSenderAddress();
					callInfo.peerPort = receivingXdr.getSenderPort();
				}
				catch (SocketException)
				{
					//
					// In case of I/O Exceptions (especially socket exceptions)
					// close the file and leave the stage. There's nothing we can
					// do anymore.
					//
					Close();
					return;
				}
				catch (org.acplt.oncrpc.OncRpcException)
				{
					//
					// In case of ONC/RPC exceptions at this stage we're silently
					// ignoring that there was some data coming in...
					//
					continue;
				}
				try
				{
					//
					// Pull off the ONC/RPC call header of the XDR stream.
					//
					callInfo.callMessage.xdrDecode(receivingXdr);
				}
				catch (System.IO.IOException)
				{
					//
					// In case of I/O Exceptions (especially socket exceptions)
					// close the file and leave the stage. There's nothing we can
					// do anymore.
					//
					Close();
					return;
				}
				catch (org.acplt.oncrpc.OncRpcException)
				{
					//
					// In case of ONC/RPC exceptions at this stage we're silently
					// ignoring that there was some data coming in, as we're not
					// sure we got enough information to send a matching reply
					// message back to the caller.
					//
					if (pendingDecoding)
					{
						pendingDecoding = false;
						try
						{
							receivingXdr.endDecoding();
						}
						catch (System.IO.IOException)
						{
							Close();
							return;
						}
						catch (org.acplt.oncrpc.OncRpcException)
						{
						}
					}
					continue;
				}
				try
				{
					//
					// Let the dispatcher retrieve the call parameters, work on
					// it and send back the reply.
					// To make it once again clear: the dispatch called has to
					// pull off the parameters of the stream!
					//
					dispatcher.dispatchOncRpcCall(callInfo, callInfo.callMessage.program, callInfo.callMessage
						.version, callInfo.callMessage.procedure);
				}
				catch (System.Exception e)
				{
					//
					// In case of some other runtime exception, we report back to
					// the caller a system error.
					//
					// In case of UDP-bases transports we can do so, because we
					// know that we can reset the buffer and serialize another
					// reply message even in case we caught some OncRpcException.
					//
					// Note that we "kill" the transport by closing it when we
					// got stuck with an I/O exception when trying to send back
					// an error reply.
					//
					if (pendingDecoding)
					{
						pendingDecoding = false;
						try
						{
							receivingXdr.endDecoding();
						}
						catch (System.IO.IOException)
						{
							Close();
							return;
						}
						catch (org.acplt.oncrpc.OncRpcException)
						{
						}
					}
					//
					// Check for authentication exceptions, which are reported back
					// as is. Otherwise, just report a system error
					// -- very generic, indeed.
					//
					try
					{
						if (e is OncRpcAuthenticationException)
						{
							callInfo.failAuthenticationFailed(((OncRpcAuthenticationException
								)e).getAuthStatus());
						}
						else
						{
							callInfo.failSystemError();
						}
					}
                    catch (SocketException)
                    {
                        Close();
                        return;
                    }
                    catch (NullReferenceException)
                    {
                        // Until I have a better way to clean up the threads on the sockets,
                        // we need to catch this here and SocketException all over the place
                        Close();
                        return;
                    }
                    catch (org.acplt.oncrpc.OncRpcException)
					{
					}
				}
			}
		}
        /// <summary>
        /// The real workhorse handling incoming requests, dispatching them and
        /// sending back replies.
        /// </summary>
        /// <remarks>
        /// The real workhorse handling incoming requests, dispatching them and
        /// sending back replies.
        /// </remarks>
        public virtual void _listen()
        {
            OncRpcCallInformation callInfo = new OncRpcCallInformation
                                                 (this);

            for (; ;)
            {
                //
                // Start decoding the incomming call. This involves remembering
                // from whom we received the call so we can later send back the
                // appropriate reply message.
                // Note that for UDP-based communication we don't need to deal
                // with timeouts.
                //
                try
                {
                    pendingDecoding = true;
                    receivingXdr.beginDecoding();
                    callInfo.peerAddress = receivingXdr.getSenderAddress();
                    callInfo.peerPort    = receivingXdr.getSenderPort();
                }
                catch (SocketException)
                {
                    //
                    // In case of I/O Exceptions (especially socket exceptions)
                    // close the file and leave the stage. There's nothing we can
                    // do anymore.
                    //
                    Close();
                    return;
                }
                catch (org.acplt.oncrpc.OncRpcException)
                {
                    //
                    // In case of ONC/RPC exceptions at this stage we're silently
                    // ignoring that there was some data coming in...
                    //
                    continue;
                }
                try
                {
                    //
                    // Pull off the ONC/RPC call header of the XDR stream.
                    //
                    callInfo.callMessage.xdrDecode(receivingXdr);
                }
                catch (System.IO.IOException)
                {
                    //
                    // In case of I/O Exceptions (especially socket exceptions)
                    // close the file and leave the stage. There's nothing we can
                    // do anymore.
                    //
                    Close();
                    return;
                }
                catch (org.acplt.oncrpc.OncRpcException)
                {
                    //
                    // In case of ONC/RPC exceptions at this stage we're silently
                    // ignoring that there was some data coming in, as we're not
                    // sure we got enough information to send a matching reply
                    // message back to the caller.
                    //
                    if (pendingDecoding)
                    {
                        pendingDecoding = false;
                        try
                        {
                            receivingXdr.endDecoding();
                        }
                        catch (System.IO.IOException)
                        {
                            Close();
                            return;
                        }
                        catch (org.acplt.oncrpc.OncRpcException)
                        {
                        }
                    }
                    continue;
                }
                try
                {
                    //
                    // Let the dispatcher retrieve the call parameters, work on
                    // it and send back the reply.
                    // To make it once again clear: the dispatch called has to
                    // pull off the parameters of the stream!
                    //
                    dispatcher.dispatchOncRpcCall(callInfo, callInfo.callMessage.program, callInfo.callMessage
                                                  .version, callInfo.callMessage.procedure);
                }
                catch (System.Exception e)
                {
                    //
                    // In case of some other runtime exception, we report back to
                    // the caller a system error.
                    //
                    // In case of UDP-bases transports we can do so, because we
                    // know that we can reset the buffer and serialize another
                    // reply message even in case we caught some OncRpcException.
                    //
                    // Note that we "kill" the transport by closing it when we
                    // got stuck with an I/O exception when trying to send back
                    // an error reply.
                    //
                    if (pendingDecoding)
                    {
                        pendingDecoding = false;
                        try
                        {
                            receivingXdr.endDecoding();
                        }
                        catch (System.IO.IOException)
                        {
                            Close();
                            return;
                        }
                        catch (org.acplt.oncrpc.OncRpcException)
                        {
                        }
                    }
                    //
                    // Check for authentication exceptions, which are reported back
                    // as is. Otherwise, just report a system error
                    // -- very generic, indeed.
                    //
                    try
                    {
                        if (e is OncRpcAuthenticationException)
                        {
                            callInfo.failAuthenticationFailed(((OncRpcAuthenticationException
                                                                )e).getAuthStatus());
                        }
                        else
                        {
                            callInfo.failSystemError();
                        }
                    }
                    catch (SocketException)
                    {
                        Close();
                        return;
                    }
                    catch (NullReferenceException)
                    {
                        // Until I have a better way to clean up the threads on the sockets,
                        // we need to catch this here and SocketException all over the place
                        Close();
                        return;
                    }
                    catch (org.acplt.oncrpc.OncRpcException)
                    {
                    }
                }
            }
        }