Go Down

Topic: HTML code is never interpreted by the browser (Read 507 times) previous topic - next topic

pierregrenoble


Bonjour


http://oct1.oct2.oct3.oct4/arduino/digital/.../...:5555


I send (not represented in this minimalist code) without problem info
to a browser from my little server on YUN.
The server returns without any problem information to
the browser (here we just return <h1> TOTO </ h1>) but ...
the HTML code is never interpreted by the browser !!

I want to say that I did a lot of research about this before posting
but I am very very beginner !

So I'm sending you this very SIMPLE code that deals only with the
part of the work that does not work:






Code: [Select]


#include <Bridge.h>

#include <BridgeServer.h>
#include <BridgeClient.h>

BridgeServer server;       // le webserver écoute le port 5555 (par défaut)

void setup()
{

    Serial.begin(9600);

    while(!Serial)
    { }   
   

    Bridge.begin();         
   


    server.noListenOnLocalhost();

    server.begin();

   
     
    Serial.println("Prêt !!");   

}

void loop()
{

       BridgeClient client = server.accept();

   
       if ( client )
       {

                Serial.println("new client");

                String command = client.readStringUntil('/');
                Serial.println(command);
                                 
                client.println("HTTP/1.1 200 OK");
                client.println("Transfer-Encoding: chunked");             
                client.println("Content-Type: text/html; charset=UTF-8");
                client.println("Connection: close"); 
                client.println();
                client.println("<!DOCTYPE html>");
                client.println("<html>");               
                client.println("<head><title>Arduino YUN</title></head>");
                client.println("<body><h1>TOTO</h1></body></html>");                   

       }

       // give the web browser time to receive the data
       delay(1);
       // close the connection:
       client.stop();

 
}






I'm on windows 10 et Yun, port série COM7



Merci à tous


Pierre Grenoble


Go Up