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';
+ b[0] =(byte)'H';
+ b[1] =(byte)'E';
+ b[2] =(byte)'L';
+ b[3] =(byte)'L';
+ b[4] =(byte)'O';
+ // b[5] =(byte)'\n';
+ b[6] =(byte)'T';
+ b[7] =(byte)'E';
+ b[8] =(byte)'S';
+ b[9] =(byte)'T';
write(b);
}
+
+ public void httpresponse(){
+
+ StringBuffer header = new StringBuffer("HTTP/1.0 200 OK\n");
+ StringBuffer htmlBuffer = new StringBuffer("<HTML>\n");
- public void responseclient(byte b){
- // buffer = b;
- // while( buffer!= null && buffer!= " ")
- // if (
- }
+ header.append("Content-type: text/html\n");
+ header.append("Content-length: 88");
+ header.append("\n\n");
+
- public void close();
+ htmlBuffer.append("<HEAD>\n<TITLE>Test HTML Document</TITLE>\n");
+ htmlBuffer.append(" </HEAD>\n");
+ htmlBuffer.append(" \n");
+ htmlBuffer.append(" <BODY>\n");
+ htmlBuffer.append(" <h1>This is your java web server's default page.</h1>");
+ htmlBuffer.append(" </BODY>\n");
+ htmlBuffer.append("</HTML>\n");
+
+ header.append(htmlBuffer.toString());
+
+ String temp_str = new String(header);
+ write(temp_str.getBytes());
+ return;
+ }
}