From 93bc6d8e0952a609b26b8a23dbb0663c8bdd6611 Mon Sep 17 00:00:00 2001 From: Dan Ballard Date: Fri, 20 May 2011 11:09:03 -0700 Subject: [PATCH 1/3] recovering Server.java from backup --- Server.java | 63 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 63 insertions(+) create mode 100644 Server.java diff --git a/Server.java b/Server.java new file mode 100644 index 0000000..97af2e8 --- /dev/null +++ b/Server.java @@ -0,0 +1,63 @@ +import java.applet.*; +//import java.awt.*; +import java.awt.event.*; +import javax.swing.Timer; +import java.awt.image.*; + +import java.lang.*; +import java.io.*; +import java.net.*; + +class Server implements Runnable { + + private ServerSocket server; + + private ResManager res; + private Applet applet; + + public Server(ResManager r, String codeBase, Applet a) { + applet = a; + res = r; + res.putNodeData("originURL", codeBase); + res.reloadSite(); + + //res.alert("Loaded site"); + + boolean bound = false; + while(!bound) + { + try { + server = new ServerSocket(res.PORT); + bound = true; + } catch (IOException e) { + res.PORT++; + } + } + applet.repaint(); + res.openDebugLog("me"); + } + + + public void run() { + try { + //res.alert("running server"); + while (!res.killSwitch) { + + Socket sock = server.accept(); + //res.alert("ACCEPTED!"); + + new Thread(new ConnHandler(sock, res)).start(); + + //handler.run(); + //res.alert("RESTARTING LOOP"); + } + server.close(); + } catch (IOException e) { + System.out.println("IOException in init(): " + e.toString()); + res.error( "IOException in init(): " + e.toString()); + } + + applet.repaint(); + + } +} From d9e5cdfaf91224906de35c0b698e3f6a65dcc190 Mon Sep 17 00:00:00 2001 From: Dan Ballard Date: Fri, 20 May 2011 11:14:08 -0700 Subject: [PATCH 2/3] Add readme for github --- README | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 README diff --git a/README b/README new file mode 100644 index 0000000..3c2b49d --- /dev/null +++ b/README @@ -0,0 +1,12 @@ +Cortex: P2P in JavaScript +Dan Ballard (2010-2011) + +Cortex is a P2P framework that runs without installation in your web browser. It's one small part Java Applet (HTTP server) and one large part JavaScript. The JavaScript is all the P2P networking code and utilities you need to get off the ground and go. + +Cortex was a school project for CS from late 2009 and early 2010 that won second place in the BCNet "Broadband Innovation challenge". On top of the P2P network, a distributed processing system was written to further demonstrate that mature complicated applications can be written in JavaScript. + +As happens with school projects, the Cortex code base was a bit of a mess when done due to massive time constraints and due dates. I am slowly trying to clean up the codebase now in my spare time. + +Step 1 was the longpull branch which added a few nice graphics feedbacl tweeks to the java applet and greatly sped up communication by making it use AJAX longpull. + +Step 2 is to modularize it to make it more extensible From 693f58ef84f7bdd8366e9c0c8e125492e2f65d86 Mon Sep 17 00:00:00 2001 From: Dan Ballard Date: Fri, 20 May 2011 11:15:21 -0700 Subject: [PATCH 3/3] add url --- README | 1 + 1 file changed, 1 insertion(+) diff --git a/README b/README index 3c2b49d..f2e2d78 100644 --- a/README +++ b/README @@ -1,5 +1,6 @@ Cortex: P2P in JavaScript Dan Ballard (2010-2011) +cortex.mindstab.net Cortex is a P2P framework that runs without installation in your web browser. It's one small part Java Applet (HTTP server) and one large part JavaScript. The JavaScript is all the P2P networking code and utilities you need to get off the ground and go.