Mir Mohammed Easin

Greenhorn
+ Follow
since Mar 07, 2011
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
In last 30 days
0
Forums and Threads

Recent posts by Mir Mohammed Easin

Hi,
Here are some of your question answers:

3) No it's not possible to create a stub and skel from remote interface. It's required remote object to create.

4) If your JDK is over 1.4 then you do not need to create stub and skel for your remote object otherwise you have to. But you can also create in JDK1.5 or 6. It'll only create stub. Basically in Java6 doesn't need to create stub. It's dynamically create stub of remote object.

5) Registering a remote object means it's bind with the rmiregistry so that client will able to connect with the RMI server and get that remote object through a rmi service name or IP/port.

6) You can export by calling super() from your remote class contructor or by exportObject() method. If you use super() then you need to extends UnicastRemoteObject of your remote class. This export is allow of your remote object to receives clients remote calls. Also if server needs to send a callback notification to a specific client then client also needs to export his/her client object. Otherwise it wont able to receives call from server.

7) Well it vary on your client and server JDK version. If server uses JDK lower than 1.5 then during binding of remote object it's required stub. So if you bind stub then oviously client will lookup stub. If you use JDK1.5 or Java6 then you don't need to bind stub strictly. You can bind remote reference.

8) If your server and client program are running on same machine then client will eventually get stub from that class directory. But if your client and server program runs on different machine then oviously you need to provide stub class to client or client have to dynamically download stub class from server through http or ftp by defining URL in -Djava.rmi.server.codebase=http://<...>

So there are so far. I'll come to you later for rest of the answers.

Cheers
14 years ago
Hi,
The best practice in socket programming is that to use same socket connection for a connected client. Once the client operation is done and no need to proceed with that client then close the socket connection for that client. Eventually the next client will be connected and Server will proceed with the new one. But if your Server is handing multiple client then you need to create a Thread for the clients which will handle every clients seperately so that no socket connection will be miss or lost.

Cheers
14 years ago
Hi,
If your exception is regarding stub class like Server_Stub.class or remote object class not found which means when you try to run your RMI server, you need to create stub class of your remote object class. For JDK1.6 doesn't need. So you've to create a Stub class as follow:

<class_directory>rmic example.hello.Server

It'll generate Server_Stub.class [also can generate Server_Skel.class for JDK1.4]. And then you need to specify codebase into your command line like:

<class_directory>java -Djava.rmi.server.codebase=file://<class directory path>/ example.hello.Server

You can programically define above codebase in your Server program:



I hope you'll not get any exception regarding class not found.

Cheers
14 years ago
Hi All,
I have RMI server and client program and both are running in my local machine. I'm using JDK1.6 for both program. Without stub class RMI server program is working nicely. But when I put my server program in another machine (different server) which is using JDK1.4 version and when I run my server program I got exception that is stub class (for my remote object class) is not found. So my question is that is it mandatory to create stub class for JDK1.4 version whereas in JDK1.6 I don't need to create stub class and server it's running. Please let me know if this is required to create stub class for JDK1.4 version and give a reference so that I can see also.

Thanks
14 years ago