Пример #1
0
        /// <summary>
        /// Constructs and initializes an ONC/RPC client object, which can
        /// communicate with the portmapper at the given host using the
        /// speicified protocol.
        /// </summary>
        /// <remarks>
        /// Constructs and initializes an ONC/RPC client object, which can
        /// communicate with the portmapper at the given host using the
        /// speicified protocol.
        /// </remarks>
        /// <param name="host">Host where to contact the portmapper.</param>
        /// <param name="protocol">
        /// Protocol to use for contacting the portmapper. This
        /// can be either <code>OncRpcProtocols.ONCRPC_UDP</code> or
        /// <code>OncRpcProtocols.ONCRPC_TCP</code> (HTTP is currently
        /// not supported).
        /// </param>
        /// <param name="timeout">
        /// Timeout in milliseconds for connection operation. This
        /// parameter applies only when using TCP/IP for talking to the
        /// portmapper. A negative timeout indicates that the
        /// implementation-specific timeout setting of the JVM and java.net
        /// implementation should be used instead.
        /// </param>
        /// <exception cref="OncRpcException">if an ONC/RPC error occurs.</exception>
        /// <exception cref="System.IO.IOException">if an I/O error occurs.</exception>
        /// <exception cref="org.acplt.oncrpc.OncRpcException"></exception>
        public OncRpcPortmapClient(IPAddress host, int protocol, int timeout)
        {
            switch (protocol)
            {
            case org.acplt.oncrpc.OncRpcProtocols.ONCRPC_UDP:
            {
                portmapClient = new org.acplt.oncrpc.OncRpcUdpClient(host, PMAP_PROGRAM, PMAP_VERSION
                                                                     , PMAP_PORT);
                break;
            }

            case org.acplt.oncrpc.OncRpcProtocols.ONCRPC_TCP:
            {
                portmapClient = new org.acplt.oncrpc.OncRpcTcpClient(host, PMAP_PROGRAM, PMAP_VERSION
                                                                     , PMAP_PORT, 0, timeout);
                // default buff size
                break;
            }

            default:
            {
                throw (new org.acplt.oncrpc.OncRpcException(org.acplt.oncrpc.OncRpcException.RPC_UNKNOWNPROTO
                                                            ));
            }
            }
        }
Пример #2
0
		/// <summary>
		/// Constructs and initializes an ONC/RPC client object, which can
		/// communicate with the portmapper at the given host using the
		/// speicified protocol.
		/// </summary>
		/// <remarks>
		/// Constructs and initializes an ONC/RPC client object, which can
		/// communicate with the portmapper at the given host using the
		/// speicified protocol.
		/// </remarks>
		/// <param name="host">Host where to contact the portmapper.</param>
		/// <param name="protocol">
		/// Protocol to use for contacting the portmapper. This
		/// can be either <code>OncRpcProtocols.ONCRPC_UDP</code> or
		/// <code>OncRpcProtocols.ONCRPC_TCP</code> (HTTP is currently
		/// not supported).
		/// </param>
		/// <param name="timeout">
		/// Timeout in milliseconds for connection operation. This
		/// parameter applies only when using TCP/IP for talking to the
		/// portmapper. A negative timeout indicates that the
		/// implementation-specific timeout setting of the JVM and java.net
		/// implementation should be used instead.
		/// </param>
		/// <exception cref="OncRpcException">if an ONC/RPC error occurs.</exception>
		/// <exception cref="System.IO.IOException">if an I/O error occurs.</exception>
		/// <exception cref="org.acplt.oncrpc.OncRpcException"></exception>
		public OncRpcPortmapClient(IPAddress host, int protocol, int timeout)
		{
			switch (protocol)
			{
				case org.acplt.oncrpc.OncRpcProtocols.ONCRPC_UDP:
				{
					portmapClient = new org.acplt.oncrpc.OncRpcUdpClient(host, PMAP_PROGRAM, PMAP_VERSION
						, PMAP_PORT, false);
					break;
				}

				case org.acplt.oncrpc.OncRpcProtocols.ONCRPC_TCP:
				{
					portmapClient = new org.acplt.oncrpc.OncRpcTcpClient(host, PMAP_PROGRAM, PMAP_VERSION
						, PMAP_PORT, 0, timeout);
					// default buff size
					break;
				}

				default:
				{
					throw (new org.acplt.oncrpc.OncRpcException(org.acplt.oncrpc.OncRpcException.RPC_UNKNOWNPROTO
						));
				}
			}
		}