Go Down

Topic: Cant connect to my arduino web server, server.available() seems to fail (Read 265 times) previous topic - next topic

rtorsvik

Hello. I have problems connecting to the webserver on my arduino mega.

The arduino initialises fine and obtain an DHCP IP-address, typically it is 192.168.15.111
When i try to connect to it, Google Chrome says that it cannot connect to 192.168.15.111
I am able to ping the arduino and i get a good response. The problem seems to be that  server.available() never becomes "true" and therfore my web-code doesn't run.

Here is the part of my code that i have problems with. I tried putting in som println's to se where my sketch fails. The "a" is printed every loop, but the "b" never apears, indicating that the sketch never enters the if(client) statement.

Code: [Select]


// listen for incoming clients
Serial.println("a");

EthernetClient client = server.available();
  if (client){
    Serial.println("b");

    while (client.connected()){
      Serial.println("c");

      if(client.available()){
        Serial.println("d");   
   
        if(client.find("GET /")){ and so on...




If someone is able to help, i will be very gratefull!

Go Up