Problem with aller-retour via wifi and without wifi

Hello, i have tried to create “alle retour” with logical gate XOR and i tried to see the result from wifi…
The code works great only when i have connected the ethernet… but i want to make it work when i havent connected ethernet…
here is my code

#include <SPI.h>
#include <Ethernet.h>

const int koumpi1 = 9;     // button 1 input
const int koumpi2 = 8;     // button 2 input
const int xor1 =  5;      // output 1
const int xor2 =  4;      // output 2
// Enter a MAC address and IP address for your controller below.
// The IP address will be dependent on your local network:
byte mac[] = { 
 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED };
IPAddress ip(192,168,1,177);

// Initialize the Ethernet server library
// with the IP address and port you want to use 
// (port 80 is default for HTTP):
EthernetServer server(80);

void setup() {
// Open serial communications and wait for port to open:
  pinMode(xor2, OUTPUT); 
  pinMode(xor1, OUTPUT);  
  // initialize the pushbutton pin as an input:
  pinMode(koumpi1, INPUT);  
  pinMode(koumpi2, INPUT); 
  while (!Serial) {
   ; // wait for serial port to connect. Needed for Leonardo only

 // start the Ethernet connection and the server:
 Ethernet.begin(mac, ip);
 Serial.print("server is at ");

void loop() {
 // listen for incoming clients
 EthernetClient client = server.available();
 if (client) {
   Serial.println("new client");
   // an http request ends with a blank line
   boolean currentLineIsBlank = true;
   while (client.connected()) {
     if (client.available()) {
       char c =;
       // if you've gotten to the end of the line (received a newline
       // character) and the line is blank, the http request has ended,
       // so you can send a reply
       if (c == '\n' && currentLineIsBlank) {
         // send a standard http response header
         client.println("HTTP/1.1 200 OK");
         client.println("Content-Type: text/html");
         client.println("Connection: close");  // the connection will be closed after completion of the response
	  client.println("Refresh: 0.1");  // refresh the page automatically every 5 sec
         client.println("<!DOCTYPE HTML>");
         // output the value of each analog input pin
         int  buttonState1 = digitalRead(koumpi2);
         int buttonState2 = digitalRead(koumpi1);
   if ((buttonState1 == HIGH)&&(buttonState2 == HIGH))  {     
    // turn LED on:    
    digitalWrite(xor1, LOW );
    digitalWrite(xor2, LOW);
  client.println("Light is off");  
   if ((buttonState1 == HIGH)&&(buttonState2 == LOW))  {     
    // turn LED on:    
    digitalWrite(xor1, HIGH);
    digitalWrite(xor2, LOW);
  client.println("Light is On");  
   if ((buttonState1 == LOW)&&(buttonState2 == HIGH))  {     
    // turn LED on:    
    digitalWrite(xor1, LOW);
    digitalWrite(xor2, HIGH);
  client.println("Light is On");  
  if ((buttonState1 == LOW)&&(buttonState2 == LOW)) {
    // turn LED off:
    digitalWrite(xor1, LOW);
    digitalWrite(xor2, LOW);
   client.println("Light is Off"); 

       if (c == '\n') {
         // you're starting a new line
         currentLineIsBlank = true;
       else if (c != '\r') {
         // you've gotten a character on the current line
         currentLineIsBlank = false;
   // give the web browser time to receive the data
   // close the connection:
   Serial.println("client disonnected");

any idea?

any idea?

All of your code is in the

 EthernetClient client = server.available();
 if (client) {

block. What do you expect to have happen if there are no client connections?

what changes i have to do, to make it work with and without ethernet ? :fearful:

what changes i have to do, to make it work with and without ethernet ?

The question could also be worded “What changes to I have to make in order to work with and without input?”.

So, what SHOULD the program do if it gets no input? Once you can define that, implementing it is easy.