Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/dist/
Empty file modified build.xml
100644 → 100755
Empty file.
8 changes: 4 additions & 4 deletions build/built-jar.properties
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#Wed, 18 Dec 2013 22:55:13 +0000


/Users/samc/Desktop/CM3033=
#Thu, 19 Dec 2013 19:48:40 +0000
H\:\\CM_3033\\Java\\CM3033-marina=
Binary file modified build/classes/CM3033Tests/Client.class
100644 → 100755
Binary file not shown.
Binary file modified build/classes/CM3033Tests/ClientApp$1.class
100644 → 100755
Binary file not shown.
Binary file modified build/classes/CM3033Tests/ClientApp$2.class
100644 → 100755
Binary file not shown.
Binary file modified build/classes/CM3033Tests/ClientApp$3.class
100644 → 100755
Binary file not shown.
Binary file modified build/classes/CM3033Tests/ClientApp$4.class
100644 → 100755
Binary file not shown.
Binary file modified build/classes/CM3033Tests/ClientApp$5.class
100644 → 100755
Binary file not shown.
Binary file modified build/classes/CM3033Tests/ClientApp$6.class
100644 → 100755
Binary file not shown.
Binary file modified build/classes/CM3033Tests/ClientApp.class
100644 → 100755
Binary file not shown.
Binary file added build/classes/CM3033Tests/DataShare.class
Binary file not shown.
Binary file modified build/classes/CM3033Tests/Server.class
100644 → 100755
Binary file not shown.
Binary file added build/classes/CM3033Tests/ServerApp$1.class
Binary file not shown.
Binary file added build/classes/CM3033Tests/ServerApp$2.class
Binary file not shown.
Binary file added build/classes/CM3033Tests/ServerApp.class
Binary file not shown.
Binary file modified build/classes/CM3033Tests/StartServer.class
100644 → 100755
Binary file not shown.
Binary file removed build/classes/CM3033Tests/Test1.class
Binary file not shown.
Binary file modified build/classes/CM3033Tests/TestClientStart.class
100644 → 100755
Binary file not shown.
Binary file removed build/classes/cm3033/lab2/ex3/Alarm.class
Binary file not shown.
Binary file removed build/classes/cm3033/lab2/ex3/Client.class
Binary file not shown.
Binary file removed build/classes/cm3033/lab2/ex3/ClientApp$1.class
Binary file not shown.
Binary file removed build/classes/cm3033/lab2/ex3/ClientApp$2.class
Binary file not shown.
Binary file removed build/classes/cm3033/lab2/ex3/ClientApp$3.class
Binary file not shown.
Binary file removed build/classes/cm3033/lab2/ex3/ClientApp$4.class
Binary file not shown.
Binary file removed build/classes/cm3033/lab2/ex3/ClientApp$5.class
Binary file not shown.
Binary file removed build/classes/cm3033/lab2/ex3/ClientApp$6.class
Binary file not shown.
Binary file removed build/classes/cm3033/lab2/ex3/ClientApp$7.class
Binary file not shown.
Binary file removed build/classes/cm3033/lab2/ex3/ClientApp.class
Binary file not shown.
Binary file removed build/classes/cm3033/lab2/ex3/HeartBeat.class
Binary file not shown.
Binary file removed build/classes/cm3033/lab2/ex3/MainAppEx3.class
Binary file not shown.
Binary file removed build/classes/cm3033/lab2/ex3/Server.class
Binary file not shown.
Binary file removed build/classes/cm3033/lab2/ex3/ServerApp$1.class
Binary file not shown.
Binary file removed build/classes/cm3033/lab2/ex3/ServerApp$2.class
Binary file not shown.
Binary file removed build/classes/cm3033/lab2/ex3/ServerApp.class
Binary file not shown.
Empty file modified manifest.mf
100644 → 100755
Empty file.
Empty file modified nbproject/build-impl.xml
100644 → 100755
Empty file.
Empty file modified nbproject/genfiles.properties
100644 → 100755
Empty file.
2 changes: 1 addition & 1 deletion nbproject/private/private.properties
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1 +1 @@
user.properties.file=/Users/samc/Library/Application Support/NetBeans/7.4/build.properties
user.properties.file=C:\\TEMP\\netbeans-settings\\build.properties
9 changes: 5 additions & 4 deletions nbproject/private/private.xml
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,11 @@
<editor-bookmarks xmlns="http://www.netbeans.org/ns/editor-bookmarks/2" lastBookmarkId="0"/>
<open-files xmlns="http://www.netbeans.org/ns/projectui-open-files/2">
<group>
<file>file:/Users/samc/Desktop/CM3033/src/CM3033Tests/StartServer.java</file>
<file>file:/Users/samc/Desktop/CM3033/src/CM3033Tests/TestClientStart.java</file>
<file>file:/Users/samc/Desktop/CM3033/src/CM3033Tests/Server.java</file>
<file>file:/Users/samc/Desktop/CM3033/src/CM3033Tests/Test1.java</file>
<file>file:/C:/Users/Mazzy/Documents/GitHub/CM3033/src/CM3033Tests/Client.java</file>
<file>file:/C:/Users/Mazzy/Documents/GitHub/CM3033/src/CM3033Tests/ClientApp.java</file>
<file>file:/C:/Users/Mazzy/Documents/GitHub/CM3033/src/CM3033Tests/Server.java</file>
<file>file:/C:/Users/Mazzy/Documents/GitHub/CM3033/src/CM3033Tests/StartServer.java</file>
<file>file:/C:/Users/Mazzy/Documents/GitHub/CM3033/src/CM3033Tests/TestClientStart.java</file>
</group>
</open-files>
</project-private>
2 changes: 1 addition & 1 deletion nbproject/project.properties
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ javadoc.splitindex=true
javadoc.use=true
javadoc.version=false
javadoc.windowtitle=
main.class=cm3033.lab2.ex3.MainAppEx3
main.class=CM3033Tests.StartServer
manifest.file=manifest.mf
meta.inf.dir=${src.dir}/META-INF
mkdist.disabled=false
Expand Down
Empty file modified nbproject/project.xml
100644 → 100755
Empty file.
1 change: 1 addition & 0 deletions src/CM3033Tests/Client.java
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@ public void run() {
if (!sendStr.equals(oldSendStr)) {
// Send the message
sendMessage(sendStr);
sendMessage("BPM:200"); //for the testing purposes
// Set the sent message record
oldSendStr = sendStr;
// Take 1 from message count as one has been sent
Expand Down
Empty file modified src/CM3033Tests/ClientApp.form
100644 → 100755
Empty file.
Empty file modified src/CM3033Tests/ClientApp.java
100644 → 100755
Empty file.
Empty file modified src/CM3033Tests/DataShare.java
100644 → 100755
Empty file.
22 changes: 22 additions & 0 deletions src/CM3033Tests/MyRejectedExecutionHandlerImpl.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package CM3033Tests;

import java.util.concurrent.RejectedExecutionHandler;
import java.util.concurrent.ThreadPoolExecutor;

/**
*
* @author 1014481
*/
public class MyRejectedExecutionHandlerImpl implements RejectedExecutionHandler {
@Override
public void rejectedExecution(Runnable runnable,
ThreadPoolExecutor executor)
{
System.out.println(runnable.toString() + " : I've been rejected ! ");
}
}

21 changes: 17 additions & 4 deletions src/CM3033Tests/Server.java
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -19,20 +19,26 @@ public class Server implements Runnable {
// store the incoming connection
private Socket incoming;
private int number;
private ServerApp serverApp;

// Create the server using the passed incoming code
public Server(Socket incoming, int no) {
public Server(Socket incoming, int no, ServerApp serverApp) {
// Set this's incoming to the passed on
this.incoming = incoming;
this.number = no;
this.serverApp = serverApp; //@ MS

}

@Override
public void run() {

try {
//serverApp.setVisible(true); //@ MS
// Configure the listener/sender
BufferedReader in = new BufferedReader(new InputStreamReader(incoming.getInputStream()));
PrintWriter out = new PrintWriter(incoming.getOutputStream(), true /* auto flush */);

// Once connected, let the user know so by printing the details
out.println(number + " You are connected to "
+ incoming.getLocalAddress().getHostName()
Expand All @@ -42,18 +48,24 @@ public void run() {
System.out.println(incoming.getLocalAddress().getHostName() + " Connected " + number);
// A boolean to store a while variable
boolean finished = false;
int bpm = 0;
while (!finished) {
bpm++;
serverApp.updateBPM(number, bpm);
serverApp.updateConnected(number);

// if the listener is ready
if (in.ready()) {
// create a String to store the sent data
String str = in.readLine().trim();
// If the string is not null
if (str != null) {
// Send the receive value back to the client
out.println("Recieved: " + str);
out.println("Received: " + str);
// Print the recieve value
System.out.println("Recieved: " + str);
System.out.println("Receieved: " + str);
// If the string is bye
//processInput(str);
if (str.trim().equals("BYE")) {
// Print that machine is disconnecting
System.out.println(incoming.getLocalAddress().getHostName() + " Disconnected");
Expand All @@ -64,6 +76,7 @@ public void run() {
}
}
// Disconnect the client
serverApp.disconnect(number);
incoming.close();
} catch (IOException e) {
System.out.println(e);
Expand Down
Loading