What does stub do on the server side ? And what is a skeleton ?
Th
I'll only address the question of why the stub needs to be on the server side as well as the client side. Th other question has already been answered.
When an exported remote object is passed to a remote object, as either a method argument or a returned value, the following happens. A stub is created on the server machine. Then it is serialized, sent across the net to the client machine, and deserialized there to make an identical copy of the stub. After that, the stub is no longer needed on the client machine.
Here is a typical scenario.
So one use of having a stub on the server side is so that it can be serialized and (a copy of it) sent to other machines, for example as part of binding. In a similar way, when a client does a lookup, the registry serializes a its copy (ss1) and sends it to to client.