Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

No commit message

  • Loading branch information...
commit 51f2f82c679462b126705cddf876733242fea16e 1 parent 0d88cab
@shiffman authored
View
16 P5/MostPixelsEverTCP/mpe/server/Connection.java
@@ -30,9 +30,9 @@
String msg = "";
boolean running = true;
- WallServer parent;
+ MPEServer parent;
- Connection(Socket socket_, WallServer p) {
+ Connection(Socket socket_, MPEServer p) {
//barrier = new CyclicBarrier(2);
socket = socket_;
parent = p;
@@ -60,7 +60,7 @@ void read(String msg) {
switch(startsWith){
// For Starting Up
case 'S':
- if (mpePrefs.DEBUG) System.out.println(msg);
+ if (MPEPrefs.DEBUG) System.out.println(msg);
//do this with regex eventually, but for now..
//(DS: also, probably just use delimiter and split?)
//this is in serious need of error checking.
@@ -85,7 +85,7 @@ void read(String msg) {
String[] info = msg.split(",");
clientID = Integer.parseInt(info[1]);
int fc = Integer.parseInt(info[2]);
- if (mpePrefs.DEBUG) System.out.println("Receive: " + clientID + ": " + fc + " match: " + parent.frameCount);
+ if (MPEPrefs.DEBUG) System.out.println("Receive: " + clientID + ": " + fc + " match: " + parent.frameCount);
if (fc == parent.frameCount) {
parent.setReady(clientID);
//if (parent.isReady()) parent.triggerFrame();
@@ -94,7 +94,7 @@ void read(String msg) {
break;
//is it receiving a "daTa"?
case 'T':
- if (mpePrefs.DEBUG) print ("adding message to next frameEvent: " + msg);
+ if (MPEPrefs.DEBUG) print ("adding message to next frameEvent: " + msg);
parent.newMessage = true;
parent.message += msg.substring(1,msg.length())+":";
//parent.sendAll(msg);
@@ -177,7 +177,7 @@ public void killMe(){
// Trying out no synchronize
public void send(String msg) {
- if (mpePrefs.DEBUG) System.out.println("Sending: " + this + ": " + msg);
+ if (MPEPrefs.DEBUG) System.out.println("Sending: " + this + ": " + msg);
try {
msg+="\n";
dos.write(msg.getBytes());
@@ -189,7 +189,7 @@ public void send(String msg) {
// Trying out no synchronize
public void sendBytes(byte[] b) {
- if (mpePrefs.DEBUG) System.out.println("Sending " + b.length + " bytes");
+ if (MPEPrefs.DEBUG) System.out.println("Sending " + b.length + " bytes");
try {
dos.writeInt(b.length);
dos.write(b,0,b.length);
@@ -201,7 +201,7 @@ public void sendBytes(byte[] b) {
// Trying out no synchronize
public void sendInts(int[] ints) {
- if (mpePrefs.DEBUG) System.out.println("Sending " + ints.length + " ints");
+ if (MPEPrefs.DEBUG) System.out.println("Sending " + ints.length + " ints");
try {
dos.writeInt(ints.length);
for (int i = 0; i < ints.length; i++) {
View
4 P5/MostPixelsEverTCP/mpe/server/ListenerConnection.java
@@ -11,7 +11,7 @@
public class ListenerConnection extends Connection {
String inputString = "";
- ListenerConnection(Socket socket_, WallServer p) {
+ ListenerConnection(Socket socket_, MPEServer p) {
super(socket_, p);
uniqueName = "Listener Conn" + socket.getRemoteSocketAddress();
}
@@ -28,7 +28,7 @@ public void run() {
} else {
msg = read((char)readIn);
if (msg != null){
- if (mpePrefs.DEBUG) print ("received from backdoor: " + msg);
+ if (MPEPrefs.DEBUG) print ("received from backdoor: " + msg);
//only attach to message if everyone's connected.
if (parent.allConnected){
parent.newMessage = true;
View
2  P5/MostPixelsEverTCP/mpe/server/mpePrefs.java → P5/MostPixelsEverTCP/mpe/server/MPEPrefs.java
@@ -6,7 +6,7 @@
package mpe.server;
-public class mpePrefs {
+public class MPEPrefs {
public static int SCREENS = 2;
public static int FRAMERATE = 30;
View
24 P5/MostPixelsEverTCP/mpe/server/WallServer.java → P5/MostPixelsEverTCP/mpe/server/MPEServer.java
@@ -15,7 +15,7 @@
import java.net.Socket;
import java.util.ArrayList;
-public class WallServer {
+public class MPEServer {
private ArrayList<Connection> connections = new ArrayList<Connection>();
private int port;
@@ -47,15 +47,15 @@
private boolean backDoorConnected = false;
BackDoor backdoor;
- public WallServer(int _screens, int _framerate, int _port, int _listenPort) {
- mpePrefs.setScreens(_screens);
- mpePrefs.setFramerate(_framerate);
+ public MPEServer(int _screens, int _framerate, int _port, int _listenPort) {
+ MPEPrefs.setScreens(_screens);
+ MPEPrefs.setFramerate(_framerate);
port = _port;
listenPort = _listenPort;
- out("framerate = " + mpePrefs.FRAMERATE + ", screens = " + mpePrefs.SCREENS + ", debug = " + mpePrefs.DEBUG);
+ out("framerate = " + MPEPrefs.FRAMERATE + ", screens = " + MPEPrefs.SCREENS + ", debug = " + MPEPrefs.DEBUG);
- connected = new boolean[mpePrefs.SCREENS]; // default to all false
- ready = new boolean[mpePrefs.SCREENS]; // default to all false
+ connected = new boolean[MPEPrefs.SCREENS]; // default to all false
+ ready = new boolean[MPEPrefs.SCREENS]; // default to all false
}
public void run() {
@@ -99,7 +99,7 @@ public synchronized void triggerFrame() {
}
}*/
- int desired = (int) ((1.0f / (float) mpePrefs.FRAMERATE) * 1000.0f);
+ int desired = (int) ((1.0f / (float) MPEPrefs.FRAMERATE) * 1000.0f);
long now = System.currentTimeMillis();
int diff = (int) (now - before);
if (diff < desired) {
@@ -252,7 +252,7 @@ else if (args[i].contains("-listenPort")) {
}
}
else if (args[i].contains("-debug")) {
- mpePrefs.DEBUG = true;
+ MPEPrefs.DEBUG = true;
}
else {
help = true;
@@ -275,7 +275,7 @@ else if (args[i].contains("-debug")) {
System.exit(1);
}
else {
- WallServer ws = new WallServer(screens, framerate, port, listenPort);
+ MPEServer ws = new MPEServer(screens, framerate, port, listenPort);
ws.run();
}
}
@@ -314,8 +314,8 @@ public void killListenerConnection(){
}
class BackDoor implements Runnable{
- WallServer parent;
- BackDoor(WallServer _parent){
+ MPEServer parent;
+ BackDoor(MPEServer _parent){
parent = _parent;
}
Please sign in to comment.
Something went wrong with that request. Please try again.