Test file added - adash
authoradash <adash>
Wed, 25 Oct 2006 00:02:31 +0000 (00:02 +0000)
committeradash <adash>
Wed, 25 Oct 2006 00:02:31 +0000 (00:02 +0000)
Robust/src/Tests/WebServerExample.java [new file with mode: 0644]
Robust/src/Tests/WebServerSocket.java [new file with mode: 0644]

diff --git a/Robust/src/Tests/WebServerExample.java b/Robust/src/Tests/WebServerExample.java
new file mode 100644 (file)
index 0000000..c863d92
--- /dev/null
@@ -0,0 +1,47 @@
+/* Startup object is generated with the initialstate flag set by the
+ *  system to start the computation up */
+
+
+/* Create New ServerSocket*/
+
+task Startup(StartupObject s {initialstate}) {
+       System.printString("W> Starting\n");
+       ServerSocket ss=new ServerSocket(9000);
+       System.printString("W> Creating ServerSocket\n");
+       taskexit(s {!initialstate}); /* Turns initial state flag off, so this task won't refire */
+}
+
+/*Listen for a request and accept request*/ 
+task AcceptConnection(ServerSocket ss{SocketPending}) {
+       System.printString("W> Waiting for connection...\n");
+       WebServerSocket web = new WebServerSocket() {WritePending};
+       ss.accept(web);
+       System.printString("W> Connected... \n");
+}
+
+/*
+task Request(Socket s{IOPending}) {
+
+} 
+*/
+
+/* Send a Write Request to Client*/
+
+task WriteIO(WebServerSocket web{WritePending}) {
+       System.printString("W> Before doing WriteIO 0\n");
+       web.datawrite();
+       System.printString("W> After doing WriteIO\n");
+       
+//     taskexit(s {!WritePending});
+}
+
+//task ReadIO(WebServerSocket web{ReadPending}, Socket s {IOPending}) {
+/*     web.datawrite();
+       System.printString("Reading String\n");
+       taskexit(s {!ReadPending});
+}
+
+task CloseSocket(WebServerSocket web{WritePending}) {
+       web.close();
+}
+*/
diff --git a/Robust/src/Tests/WebServerSocket.java b/Robust/src/Tests/WebServerSocket.java
new file mode 100644 (file)
index 0000000..629a578
--- /dev/null
@@ -0,0 +1,48 @@
+public class WebServerSocket extends Socket {
+       // Websocket flag
+       flag ReadPending;
+       flag WritePending;
+       //File Descriptor
+       int fd;
+       // Buffer to store String/  
+       public byte[] buffer;
+       
+       
+
+       //Constructor
+       public WebServerSocket(){
+               System.printString("DEBUG : Calling WebServerSocket constructor\n");
+       }
+       
+       public void dataread(){         
+
+       }
+       
+       public void datawrite(){ 
+               byte[] b = new byte[10];
+               //byte x=(byte)'x'
+               b[0] =(byte)'h';
+               b[1] =(byte)'h';
+               b[2] =(byte)'e';
+               b[3] =(byte)'e';
+               b[4] =(byte)'l';
+               b[5] =(byte)'l';
+               b[6] =(byte)'l';
+               b[7] =(byte)'o';
+//             b[0] = '65';
+//             b[1] = '66';
+//             b[2] =  '67';
+//             b[3] = '68';
+//             b[4] = '69';
+               write(b);
+       }
+
+       public void responseclient(byte b){
+       //      buffer = b;
+       //      while( buffer!= null && buffer!= " ")
+       //      if (
+       }
+
+       public void close();   
+}
+