I've revived an old java project I did in college. Basic chat type program like ICQ which stores offline messages and users in a database etc, etc.

I've recently switched the database from Access to MySQL and am considering some other alterations.

I've been reading a bit on RMI. I guess what I'd like to know is can I pass more than just string across the sockets? The program uses a BufferedReader and I just built it to pass delimited strings which both the client and server parsed on either end.

I'm not sure if java supports user-defined-types either, but I guess thats basically what I'd like to pass back and forth just to make things easier.

As long as the object properly implements serialisable then you can send it through an ObjectOutputStream wrapped around the OutputStream retreived through socket.getOutputStream, and read through an ObjectInputStream wrapped around the receiving ends socket.getInputStream.

And, of course, RMI and CORBA are other possibilites as long as you define your stubs correctly. Sun provides an RMI tutorial here http://java.sun.com/docs/books/tutorial/rmi/index.html

Thanks, I'll look more into wrapping the ObjectOutputStream. RMI and CORBA sound great by SUNs tutorials, but I think for something simple as what I'm trying to accomplish they will add too much baggage and just complicate things needless. I'd rather the lower amount of overhead possible.

RMI in fact makes working with remote objects a lot easier than doing the entire stuff of serialisation, transmission, and receiving yourself.

The actual overhead on the client is quite limited, little more than it would be if you were to establish a socket connection to the server (and the server becomes a lot easier to write).

The only disadvantage (which you'd also have if you're serialising objects yourself) is that it won't be portable to other platforms without serious effort.
Only platform agnostic systems like SOAP and Corba provide for that out of the box.

A complete mulithreaded server that will provide a single RMI service (Remote object) can be coded in about 10KB of Java code (not counting the Remote object itself, which is just a Java bean with some special rules) and about half of that's comments and logging code.
Those are real figures, figures from an RMI application I created for my certification (currently on hold still awaiting funds for the final exam).

The only disadvantage (which you'd also have if you're serialising objects yourself) is that it won't be portable to other platforms without serious effort.
Only platform agnostic systems like SOAP and Corba provide for that out of the box.

So what your saying is, if I want maximum portability and to run effortlessly on any platform, I should just stick with sockets and continue parsing strings?

I guess I could just brake an object down to a delimited string, transmit through socket, and then rebuild on the other end.... Or is Corba worth learning for this wanted (read: not needed) functionality?

Depends on what you want.
If communication with non-Java systems is required, you will need to pass your data in a way that those platforms can understand.
The easiest way to do that is to use some protocol based on flat text with no binary data whatsoever.

Corba is hardly ever used anymore, been completely superceded by SOAP.

Corba is hardly ever used anymore, been completely superceded by SOAP.

From Wikipedia:
SOAP is a protocol for exchanging XML-based messages over computer networks, normally using HTTP/HTTPS. SOAP forms the foundation layer of the Web services stack, providing a basic messaging framework that more abstract layers can build on.

Looks like I need to do some reading on this, as this is very similar to what I'm trying to accomplish.

Thanks jwenting, and by the way, do you have a life outside these forums? lol :)

This article has been dead for over six months. Start a new discussion instead.