posted 20 years ago
If you're using RMI and you've got a class running on the server which implements the Remote interface, then when a client does Naming.lookup() or whatever and gets aremote reference to your server instance, they can call methods. If the client calls update() and the server throws a SecurityException(), the client will see a SecurityException thrown from the update() method it called on the remote proxy. Behind the scenes, RMI has serialized the exception thrown on the server and passed it to the client, making it look like it was thrown form the client. (All exceptions implement Serializable, so this is possible). If you use sockets rather than RMI, you will have to send some sort of signal through the socket to tell the client that an exception needs to be thrown. The simplest wayt to do this is probably to use an ObjectOutputStream to serialize the exception and send it through the socket, much like RMI does (except you ahve to code it yourself). Or you could devise some other communications protocol which may be faster but require even more coding on your part; it's up to you.
"I'm not back." - Bill Harding, Twister