Results 1 to 1 of 1
  1. #1
    zardos is offline Member
    Join Date
    Jan 2011
    Posts
    8
    Rep Power
    0

    Default Socket, html not showing in all browsers

    Hello sockets again, now my code workes well on chrome, and show me the html page, but in some broswes it generates

    "The server faild to communicate."

    How do i get it to work cross broswe?

    Thanks!

    Java Code:
    BufferedReader in = new BufferedReader(new InputStreamReader(client.getInputStream()));
                            DataOutputStream output = new DataOutputStream(client.getOutputStream());
    
                            String line = null;
                            GET_STRING = in.readLine();
                            String str = ".";
                            while (!str.equals(""))
                              str = in.readLine();
                            
                            String data;
                            data = "<html>";
                            data += "<head>";
                            data += "<title>Test</title>";
                            data += "<body>";
                            data += "<div>Test</div>";
                            data += "</body></html>";
                            output.writeBytes("HTTP 1.0 200 OK\r\n");
                            output.writeBytes("");
                            Date now = new Date(  );
                            output.writeBytes("Date: " + now + "\r\n");
                            output.writeBytes("Server: JHTTP 1.0\r\n");
                            output.writeBytes("Content-length: " + data.length() + "\r\n");
                            output.writeBytes("Content-type: text/html\r\n\r\n");
                            output.writeBytes("");
                            output.writeBytes(data);
                            output.flush();
                            
                            client.close();
    Last edited by zardos; 03-05-2011 at 12:24 AM. Reason: Forgot the code :)

Similar Threads

  1. Refresh browsers
    By xnotte in forum Advanced Java
    Replies: 2
    Last Post: 02-19-2011, 06:41 AM
  2. help with browsers
    By paulpa66 in forum New To Java
    Replies: 1
    Last Post: 08-07-2010, 01:41 PM
  3. Applets painting outside borders in web browsers
    By sirdori in forum New To Java
    Replies: 2
    Last Post: 11-20-2008, 06:14 PM
  4. First Applet not running on browsers
    By Centinela66 in forum Java Applets
    Replies: 11
    Last Post: 10-09-2008, 01:58 PM
  5. Showing ResultSet in HTML table
    By Java Tip in forum Java Tip
    Replies: 0
    Last Post: 01-27-2008, 08:09 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •