FileDocCategorySizeDatePackage
DoubleClient.javaAPI DocExample1202Tue Feb 24 10:24:02 GMT 1998None

DoubleClient

public class DoubleClient extends Object

Fields Summary
Constructors Summary
Methods Summary
public static voidmain(java.lang.String[] args)

    String host = args[0];
    int port = 7999;
    String user = "Jonathan";
    String password = "buendia";
    Socket s = new Socket(host, port);

    DoubleClient client = new DoubleClient();
    client.sendAuthentication(user, password, s.getOutputStream());

    s.close();
  
public voidsendAuthentication(java.lang.String user, java.lang.String password, java.io.OutputStream outStream)

    DataOutputStream out = new DataOutputStream(outStream);
    long t1 = (new Date()).getTime();
    double q1 = Math.random();
    byte[] protected1 = Protection.makeDigest(user, password, t1, q1);
    long t2 = (new Date()).getTime();
    double q2 = Math.random();
    byte[] protected2 = Protection.makeDigest(protected1, t2, q2);

    out.writeUTF(user);
    out.writeLong(t1);
    out.writeDouble(q1);
    out.writeLong(t2);
    out.writeDouble(q2);
    out.writeInt(protected2.length);
    out.write(protected2);
    out.flush();