You are on page 1of 1

// LoginRMIClient.

java RMI Login client


import
import
import
import
import

java.rmi.*;
java.rmi.registry.*;
java.rmi.server.*;
java.lang.*;
java.io.*;

public class LoginRMIClient


{
public static void main(String args[])
{
// Create and install the security manager
System.setSecurityManager(new RMISecurityManager());
int status=0;
BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
String name,name1;
try
{
LoginRMI myLogin = (LoginRMI)Naming.lookup("//"
+ args[0] + "/" + "myLoginRMI");
System.out.println("Enter loginname :");
name = in.readLine();
status = myLogin.checklogin(name);
if(status == 1)
{
System.out.println("Introduce la contrasea:");
name1 = in.readLine();
status = myLogin.checkpassword(name,name1);
if(status == 1)
{
System.out.println("exito inicie secion.....");
}
else
{
System.out.println("A Ingresado una contrasea incorecta");
}
}
else
{
System.out.println("Ha ingresado mal el nombre del usuario");
}
} catch(Exception e)
{ System.err.println("System Exception" + e);
}
System.exit(0);
}
}