Are there any guidelines as to when I should use RMI and when I should prefer plain old socket connections? What are the advantages/disadvantages of each of these technologies ?
RMI elevates network programming to a much higher plane. With RMI, Java objects can easily invoke the methods of remote objects as if they were locally available. The amazing part is that the remote objects may be under the jurisdiction of an entirely different JVM, running on a different host halfway around the world! Also, since you interact with an RMI object much like a local object, remote methods can send and receive just about any valid Java object without having to worry about flattening it out to a serial data stream. RMI automatically provides you that feature by utilizing the underlying Object Serialization mechanism. The communication between the RMI client and server itself is facilitated by the Java Remote Method Protocol (JRMP) or Internet Inter-Orb Protocol (IIOP).
RMI is especially useful for deployment as a multi-tier bridging mechanism, and can serve as an effective "glue" for integrating other enterprise Java technologies like JDBC and JNI. RMI remote objects serving as wrappers to database and legacy system integration code are also highly scalable due to the inherently distributed nature of the technology itself.