RMI Java

T

Ted

Hi,

I am planning to do a chat client / server using Java RMI.
My only problem is that i'm not too sure what classes and interfaces
i'll need.

I have looked at many examples of this and all seem to be different,
obviously.

I was thinking I should have an:
IServer.java - interface
ServerImpl.java - class implementing IServer.java
IClient.java - Interface
ClientImpl.java - class implementing IClient.

Am I right in this?
I would aprechiate it if anyone has experience in this if they could
let me know if i'm on the right track.

Kind Regards,
Ted
 
E

Espen Hatleskog

Ted said:
Hi,

I am planning to do a chat client / server using Java RMI.
My only problem is that i'm not too sure what classes and interfaces
i'll need.

I have looked at many examples of this and all seem to be different,
obviously.

I was thinking I should have an:
IServer.java - interface
ServerImpl.java - class implementing IServer.java
IClient.java - Interface
ClientImpl.java - class implementing IClient.

Am I right in this?
I would aprechiate it if anyone has experience in this if they could
let me know if i'm on the right track.

Yes, you are.
This is basically all you need to get started:

public interface ChatServer extends Remote{ ...

public class ChatServerImpl extends UnicastRemoteObject implements
ChatServer { ...


public interface ChatClient extends Remote{ ...

public class ChatClientImpl extends UnicastRemoteObject implements
ChatClient, Serializable{ ...
Kind Regards,
Ted

regards

Espen Hatleskog
 
T

Tim Jowers

Hi,

I am planning to do a chat client / server using Java RMI.
My only problem is that i'm not too sure what classes and interfaces
i'll need.

I have looked at many examples of this and all seem to be different,
obviously.

I was thinking I should have an:
IServer.java - interface
ServerImpl.java - class implementing IServer.java
IClient.java - Interface
ClientImpl.java - class implementing IClient.

Am I right in this?
I would aprechiate it if anyone has experience in this if they could
let me know if i'm on the right track.

Kind Regards,
Ted

Ted, RMI works fine. Gotta start the RMI server and make sure the
"server" class is registered to run. Then run the client. Look for
some examples on the net. Basically if I remmeber correctly you write
the server class, run rmic to create a "skeleton", and use this and
write the client. Then start up the rmid and make sure the server
program has been registered and in classpath I think. Then run the
client.
http://mindprod.com/jgloss/rmi.html

BTW, telnet localhost 1099 to make sure rmid is listening. 1099 is the
default port rmid uses I think.

Tim
 
T

Ted

Hi,

Thanks for the help and advice.

I have now got my classes and interfaces set up on paper but i'm not
too sure if i'm right in what i'm doing?
IServer.java - interface
ServerImpl.java - class implementing IServer.java
IClient.java - Interface
ClientImpl.java - class implementing IClient.

Should I also have a connection class and Interface?
All the examples I have looked at have all of the above classes plus
sometimes a Chatter class and interface or sometimes a Connection
class and Interface.

Can anyone suggest the best design for what i'm tryig to do.

Kind Regards,
Ted
 
T

Ted

Hi again,

This is in reply to my own post.

I have since got my RMI chat working but am having one problem with
the applet.

The problem is:
I start remiregistry, the server... and then the client applet. All is
fine up to here.
But when I enter text to be sent to all users the applet is not
displaying the text in the textarea as I have specified. I done
system.out.println and the name and message are being received but the
textarea just won't display the text.
I am getting no errors.

Does anyone know what could be wrong here?

Thanks again,
Ted
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,432
Messages
2,571,680
Members
48,796
Latest member
Greg L.

Latest Threads

Top