Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package RMI;
- import java.rmi.registry.*;
- import java.rmi.server.UnicastRemoteObject;
- import java.rmi.*;
- import java.util.Date;
- public class Server extends UnicastRemoteObject implements RMIServerInterf{
- protected Server() throws RemoteException {
- super();
- try {
- LocateRegistry.createRegistry(1099);
- Registry registry = LocateRegistry.getRegistry(1099);
- registry.rebind("serveur", this);
- }
- catch ( Exception e) {
- e.printStackTrace();
- }
- }
- public Date getServerDate()throws RemoteException{
- return new Date();
- }
- public static void main(String[] args) {
- try {
- new Server();
- } catch (RemoteException e) {
- e.printStackTrace();
- }
- }
- }
Add Comment
Please, Sign In to add comment