Skip to content

Commit

Permalink
No commit message
Browse files Browse the repository at this point in the history
  • Loading branch information
daniel.shiffman committed Nov 14, 2010
1 parent 7d2ecce commit d08882d
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 23 deletions.
16 changes: 8 additions & 8 deletions P5/MostPixelsEverTCP/mpe/server/Connection.java
Expand Up @@ -30,9 +30,9 @@ public class Connection extends Thread {
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;
Expand Down Expand Up @@ -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.
Expand All @@ -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();
Expand All @@ -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);
Expand Down Expand Up @@ -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());
Expand All @@ -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);
Expand All @@ -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++) {
Expand Down
4 changes: 2 additions & 2 deletions P5/MostPixelsEverTCP/mpe/server/ListenerConnection.java
Expand Up @@ -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();
}
Expand All @@ -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;
Expand Down
Expand Up @@ -6,7 +6,7 @@

package mpe.server;

public class mpePrefs {
public class MPEPrefs {

public static int SCREENS = 2;
public static int FRAMERATE = 30;
Expand Down
Expand Up @@ -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;
Expand Down Expand Up @@ -47,15 +47,15 @@ public class WallServer {
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() {
Expand Down Expand Up @@ -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) {
Expand Down Expand Up @@ -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;
Expand All @@ -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();
}
}
Expand Down Expand Up @@ -314,8 +314,8 @@ public void killListenerConnection(){
}

class BackDoor implements Runnable{
WallServer parent;
BackDoor(WallServer _parent){
MPEServer parent;
BackDoor(MPEServer _parent){
parent = _parent;
}

Expand Down

0 comments on commit d08882d

Please sign in to comment.