Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Fixed the host issue in Agent.java too

  • Loading branch information...
commit 47fec15089e66548cf935fbbbf74e201cc784ed5 1 parent 0e3a387
@pksunkara authored
Showing with 6 additions and 4 deletions.
  1. +6 −4 LamportClock/Agent.java
View
10 LamportClock/Agent.java
@@ -4,6 +4,7 @@
public class Agent {
private static String nodeName;
+ private static String port;
private static FileWriter fileStream;
private static Socket pentagonSocket;
@@ -13,18 +14,19 @@
private static OtherClient otherClientList[] = new OtherClient[2];
public static void main(String[] args) throws Exception {
- if(args.length!=2) {
- System.out.println("Usage: Agent <codename> <port>");
+ if(args.length!=3) {
+ System.out.println("Usage: Agent <codename> <host> <port>");
System.exit(1);
}
nodeName = args[0];
+ port = args[2];
- pentagonSocket = new Socket("localhost", 5000);
+ pentagonSocket = new Socket(args[1], 5000);
pentagonOutput = new ObjectOutputStream(pentagonSocket.getOutputStream());
pentagonInput = new ObjectInputStream(pentagonSocket.getInputStream());
pentagonOutput.writeObject("Agent " + nodeName + " ready to proceed.");
- pentagonOutput.writeObject(args[1]);
+ pentagonOutput.writeObject(port);
for(int i=0; i<2; i++)
otherClientList[i] = new OtherClient();
Please sign in to comment.
Something went wrong with that request. Please try again.