/// <summary> /// Creates and exports a new UnicastRemoteObject object using the /// particular supplied port and socket factories. /// /// <para>Either socket factory may be {@code null}, in which case /// the corresponding client or server socket creation method of /// <seealso cref="RMISocketFactory"/> is used instead. /// /// </para> /// </summary> /// <param name="port"> the port number on which the remote object receives calls /// (if <code>port</code> is zero, an anonymous port is chosen) </param> /// <param name="csf"> the client-side socket factory for making calls to the /// remote object </param> /// <param name="ssf"> the server-side socket factory for receiving remote calls </param> /// <exception cref="RemoteException"> if failed to export object /// @since 1.2 </exception> //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET: //ORIGINAL LINE: protected UnicastRemoteObject(int port, RMIClientSocketFactory csf, RMIServerSocketFactory ssf) throws RemoteException protected internal UnicastRemoteObject(int port, RMIClientSocketFactory csf, RMIServerSocketFactory ssf) { this.Port = port; this.Csf = csf; this.Ssf = ssf; ExportObject((Remote)this, port, csf, ssf); }
/// <summary> /// Returns a locally created remote reference to the remote object /// <code>Registry</code> on the specified <code>host</code> and /// <code>port</code>. Communication with this remote registry will /// use the supplied <code>RMIClientSocketFactory</code> <code>csf</code> /// to create <code>Socket</code> connections to the registry on the /// remote <code>host</code> and <code>port</code>. /// </summary> /// <param name="host"> host for the remote registry </param> /// <param name="port"> port on which the registry accepts requests </param> /// <param name="csf"> client-side <code>Socket</code> factory used to /// make connections to the registry. If <code>csf</code> /// is null, then the default client-side <code>Socket</code> /// factory will be used in the registry stub. </param> /// <returns> reference (a stub) to the remote registry </returns> /// <exception cref="RemoteException"> if the reference could not be created /// @since 1.2 </exception> //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET: //ORIGINAL LINE: public static Registry getRegistry(String host, int port, java.rmi.server.RMIClientSocketFactory csf) throws java.rmi.RemoteException public static Registry GetRegistry(String host, int port, RMIClientSocketFactory csf) { Registry registry = null; if (port <= 0) { port = Registry_Fields.REGISTRY_PORT; } if (host == null || host.Length() == 0) { // If host is blank (as returned by "file:" URL in 1.0.2 used in // java.rmi.Naming), try to convert to real local host name so // that the RegistryImpl's checkAccess will not fail. try { host = java.net.InetAddress.LocalHost.HostAddress; } catch (Exception) { // If that failed, at least try "" (localhost) anyway... host = ""; } } /* * Create a proxy for the registry with the given host, port, and * client socket factory. If the supplied client socket factory is * null, then the ref type is a UnicastRef, otherwise the ref type * is a UnicastRef2. If the property * java.rmi.server.ignoreStubClasses is true, then the proxy * returned is an instance of a dynamic proxy class that implements * the Registry interface; otherwise the proxy returned is an * instance of the pregenerated stub class for RegistryImpl. **/ LiveRef liveRef = new LiveRef(new ObjID(ObjID.REGISTRY_ID), new TCPEndpoint(host, port, csf, null), false); RemoteRef @ref = (csf == null) ? new UnicastRef(liveRef) : new UnicastRef2(liveRef); return((Registry)Util.createProxy(typeof(RegistryImpl), @ref, false)); }
/// <summary> /// Exports the remote object to make it available to receive incoming /// calls, using a transport specified by the given socket factory. /// /// <para>Either socket factory may be {@code null}, in which case /// the corresponding client or server socket creation method of /// <seealso cref="RMISocketFactory"/> is used instead. /// /// </para> /// </summary> /// <param name="obj"> the remote object to be exported </param> /// <param name="port"> the port to export the object on </param> /// <param name="csf"> the client-side socket factory for making calls to the /// remote object </param> /// <param name="ssf"> the server-side socket factory for receiving remote calls </param> /// <returns> remote object stub </returns> /// <exception cref="RemoteException"> if export fails /// @since 1.2 </exception> //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET: //ORIGINAL LINE: public static Remote exportObject(Remote obj, int port, RMIClientSocketFactory csf, RMIServerSocketFactory ssf) throws RemoteException public static Remote ExportObject(Remote obj, int port, RMIClientSocketFactory csf, RMIServerSocketFactory ssf) { return(ExportObject(obj, new UnicastServerRef2(port, csf, ssf))); }
/// <summary> /// Creates and exports a <code>Registry</code> instance on the local /// host that uses custom socket factories for communication with that /// instance. The registry that is created listens for incoming /// requests on the given <code>port</code> using a /// <code>ServerSocket</code> created from the supplied /// <code>RMIServerSocketFactory</code>. /// /// <para>The <code>Registry</code> instance is exported as if /// the static {@link /// UnicastRemoteObject#exportObject(Remote,int,RMIClientSocketFactory,RMIServerSocketFactory) /// UnicastRemoteObject.exportObject} method is invoked, passing the /// <code>Registry</code> instance, the specified <code>port</code>, the /// specified <code>RMIClientSocketFactory</code>, and the specified /// <code>RMIServerSocketFactory</code> as arguments, except that the /// <code>Registry</code> instance is exported with a well-known object /// identifier, an <seealso cref="ObjID"/> instance constructed with the value /// <seealso cref="ObjID#REGISTRY_ID"/>. /// /// </para> /// </summary> /// <param name="port"> port on which the registry accepts requests </param> /// <param name="csf"> client-side <code>Socket</code> factory used to /// make connections to the registry </param> /// <param name="ssf"> server-side <code>ServerSocket</code> factory /// used to accept connections to the registry </param> /// <returns> the registry </returns> /// <exception cref="RemoteException"> if the registry could not be exported /// @since 1.2 /// </exception> //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET: //ORIGINAL LINE: public static Registry createRegistry(int port, java.rmi.server.RMIClientSocketFactory csf, java.rmi.server.RMIServerSocketFactory ssf) throws java.rmi.RemoteException public static Registry CreateRegistry(int port, RMIClientSocketFactory csf, RMIServerSocketFactory ssf) { return(new RegistryImpl(port, csf, ssf)); }