-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Maxwell You
committed
Feb 13, 2018
1 parent
2dc1c9d
commit 2b3a375
Showing
8 changed files
with
144 additions
and
34 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
66 changes: 65 additions & 1 deletion
66
src/cs455/overlay/wireformats/OverlayNodeReportsTaskFinished.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,68 @@ | ||
package cs455.overlay.wireformats; | ||
|
||
public class OverlayNodeReportsTaskFinished { | ||
import java.io.ByteArrayOutputStream; | ||
import java.io.DataOutputStream; | ||
import java.io.IOException; | ||
|
||
public class OverlayNodeReportsTaskFinished implements Protocol, Event { | ||
private int type = OVERLAY_NODE_REPORTS_TASK_FINISHED; | ||
private String IP; | ||
private int portNum; | ||
private int nodeID; | ||
|
||
public OverlayNodeReportsTaskFinished(String IP, int portNum, int nodeID) { | ||
this.IP = IP; | ||
this.portNum = portNum; | ||
this.nodeID = nodeID; | ||
} | ||
|
||
@Override | ||
public int getType() { | ||
return type; | ||
} | ||
|
||
public String getIP() { | ||
return IP; | ||
} | ||
|
||
public int getPortNum() { | ||
return portNum; | ||
} | ||
|
||
public int getNodeID() { | ||
return nodeID; | ||
} | ||
|
||
@Override | ||
public byte[] getBytes() throws IOException { | ||
/* Msg outline: | ||
int: OVERLAY_NODE_REPORTS_TASK_FINISHED | ||
int: length of following IP field | ||
byte[]: IP addr | ||
int: portNum | ||
int: nodeID */ | ||
byte[] marshalledBytes = null; | ||
|
||
ByteArrayOutputStream baOutStream = new ByteArrayOutputStream(); | ||
DataOutputStream dOut = new DataOutputStream(baOutStream); | ||
|
||
dOut.writeInt(type); | ||
|
||
byte[] IPbytes = IP.getBytes(); | ||
int IPlength = IPbytes.length; | ||
dOut.writeInt(IPlength); | ||
dOut.write(IPbytes); | ||
|
||
dOut.writeInt(portNum); | ||
|
||
dOut.writeInt(nodeID); | ||
|
||
dOut.flush(); | ||
marshalledBytes = baOutStream.toByteArray(); | ||
|
||
baOutStream.close(); | ||
dOut.close(); | ||
|
||
return marshalledBytes; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
test_home=<~/455/cs455-hw1/src> | ||
for i in 'cat machine_list' | ||
do | ||
echo 'logging into ' ${i} | ||
gnome-terminal -x bash -c "ssh -t ${i} 'cd ${text_home}; java cs455.overlay.node.MessagingNode <hanoi> <51000>;bash;'" &\ | ||
done |