posted 23 years ago
I'll try to expand a bit on the previous reply... But take this
with a grain of salt because I have not really begun the server-
side of the assignment.
Sockets+Serialization: On the client side, you send a Request
to the server to "do something." You open a socket, send the
Request through, and wait for a Response. The Request contains
some sort of command, and some data in Serialized form. The
server processes the request and sends back a Response on
that socket connection. The Reponse likely contains a
result code of some sort (eg. SUCCESS, FAILURE, NODATA, etc...)
as well as the data returned in serialized form if any exists.
The client deals appropriately with the Response. End of story.
RMI: You set up methods on your server to handle client requests
inside of a class. In RMI these methods are special in that they
are Remote methods. With the appropriate magical incantations
involving reviving the skeletons of the dead and stubbing your
toes while dancing inside a pentagram of upside-down nails, you
can call these methods from the client without really having to
know as a programmer that these methods are actually executed on
the server. The existence of the server is relatively invisible
to the programmer.
Comparing these two approaches seems a bit weird to me because
taken to its logical conclusion, the first approach may
involve writing your own version of RMI completely from scratch.
Obviously doing that would be well beyond the scope of this
assignment. The first approach does seem more "open" to me in
that you can (sort of) publish your protocol without any
particular implementation attached to it at all. The second
approach is more "closed" in that it would be difficult for
someone else to write a client for your server without your
cooperation. The second approach may involve more overhead
because it has a generic mechanism for "marshalling" which as I
understand it is the process of handling the request and sending
back a response. In terms of transparency, scalability, and
easy of programming (once the basic framework has been set up,
which I understand can be somewhat of a challenge with RMI),
I think RMI has the upper hand. For the application we have to
build, it seems to me that the only really meaningful reason
to use sockets+serialization would be if one could not use
RMI for some reason.
This is an issue I have found stimulating to think about, so
if anyone has any comments or feedback, I would love to see it.
Vlad