Display IP of current TCP connection on serial LCD

I have put together a web server which turns items on an off , photocell etc - works fine

I am now trying to add the ability to see any ip that is currently connected to my server

ON THE SERIAL LCD: i would like to:

  1. LINE 1 Display - "CONNECTED" -
  2. LINE 2 Display - IP number - ??

I have looked around and cant seem to find a method to display the ip

Help, Joe

I have looked around and cant seem to find a method to display the ip

First thing you need to do is get the IP address. Once you have it, displaying it is easy.

Have you got the IP address? Have you searched the forum for the thread where how to modify the library to get the ID address was documented?

Why are you shouting?

// Web server to turn devices on / off via a web page

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

// declare network stuff

byte mac[] = {  0x90, 0xA2, 0xDA, 0x00, 0xCD, 0x32 };  //Set your Ethernet Shield's MAC address
byte ip[] = {  192,168,1,121 };    // Set your shield's  IP address
byte gateway[] = {  192,168,1,1 };   //if you need  a gateway IP
byte subnet[] = { 255,255,255,0 };    // Change  to your subnet address
byte client_ip[4];
  
  
EthernetServer  server(8584);                // server port 

// declare variables

int     ledPin = 6;                // LED1 
int     heatpin = 7;               // ANTENNA
int     aedpin = 5;                // LED3  
int     fedpin = 8;                // fE PWR 
int     medpin = 9;                // me - anolog pin 9 for fan control
int     sensorPin = A0;            // analog in 0 forlight sense
int     sensorValue = 0;           // integer for the analog sensor
int     PIRstate = 0;              // variable for PIR sensor status
int     PIR = 2;                   // PIR sensor is connected to digital pin 2
int     motorlevel = 0;                // motor
String  readString = String(30);   // string for fetching data from address
boolean LEDON = false;             // LED1 status flag
boolean HEDON = false;             // ANTENNA status flag  
boolean AEDON = false;             // led3 status AE
boolean FEDON = false;             // power FE pin status
boolean MEDON = false;
boolean MEDON1 = false;            //MED SPEED STATUS ON
boolean PEDON = false;

 
// SETUP NOW

void setup()
{    
  
  Ethernet.begin(mac, ip, gateway, subnet ); //start Ethernet
  server.begin();  //test
  
  
  pinMode(ledPin, OUTPUT); //Set pin 6 to output
  pinMode(heatpin, OUTPUT); // set pin 7 to output
  pinMode(aedpin, OUTPUT); // set pin 5 to output
  pinMode(fedpin, OUTPUT); // set pin 8 to output
  pinMode(PIR, INPUT); // set pir to input
  pinMode(medpin, OUTPUT); // set pin a3 to output
 
   
  sensorValue = analogRead(sensorPin);
  }
// LOOP NOW 

void loop(){
  
  EthernetClient client = server.available();  // Create a client connection
  
  if (client) {
    boolean current_line_is_blank = true; //new
    while (client.connected()) {
      if (client.available()) {
        char c = client.read();
        // if we've gotten to the end of the line (received a newline
        // character) and the line is blank, the http request has ended,
        // send a reply
        
        if (readString.length() < 30) { //read char by char HTTP request
          readString.concat(c); 
        } //store characters to string

       
// HTML Code  

if (c == '\n' && current_line_is_blank) {
          
          // HTML Code
          client.println(F("HTTP/1.1 200 OK")); //output HTML data starting with standard header
          client.println(F("Content-Type: text/html"));
          client.println();
          client.print(F("<body style=background-color:BLACK>")); //set background to BLACK
          // Auto refresh webpage every 60 seconds
          client.println(F("<META HTTP-EQUIV=REFRESH CONTENT=60 URL=>"));
          client.println("<center>");
          client.println(F("<font color=’green’><h1>INTERNET -- CONTROL </font></h1>/"));//send first heading
          client.println(F("<hr />"));
          client.println(F("<font color=’#0D8112’ size=’5?> "));
          client.println("</center>");
          motorlevel = 0;
      }       
  
           //indexOf("L=")

        if (c == '\n') { //if HTTP request has ended

          int Le = readString.indexOf("L="); //here is a key component of where
          int He = readString.indexOf("H="); //the status is being read by the arduino
          int Ae = readString.indexOf("A=");
          int Fe = readString.indexOf("F=");
          int Me = readString.indexOf("M="); //motor / fan 
          int Pe = readString.indexOf("P="); //OFF

          // Check if anything  should be lighted or turned on
         
         if (Me > 1){

            if (readString.substring(Me,(Me+3)) == "M=1") { //motor has to be turned ON
             motorlevel = 255;
              analogWrite(medpin, motorlevel); // set the LED on
            
             MEDON = true; //  USED FOR STATUS
             MEDON1 = false; // USED FOR STATUS
             }

             if (readString.substring(Me,(Me+3)) == "M=0") {
              //motor dim / 
              motorlevel = 125;
              analogWrite(medpin,motorlevel); // set the FAN /LED DIM
               MEDON1 = true;
               MEDON = false;
              }
              else if (readString.substring(Me,(Me+3)) == "M=2") {
              //motor OFF / 
              motorlevel = 0;
              analogWrite(medpin,motorlevel); // set the / fan /LED OFF
                            
              MEDON = false;
              MEDON1 = false;
            }
          }
                   

   // This is the get ip code i found 

 client.IP_address(&client_ip[0]);
          client.println("Your IP is:");
          for (int n = 0; n<=3; n++)
            {
            client.print((int)client_ip[n]);
            client.print(".");
            }
 // ------------------------------------------------------------------
// WEB PAGE Footer
          
          client.println(F("<hr><center><a href=http://RADMAN.NO-IP.COM:8888>WEBPAGE</a>
"));
          client.println(F("<p><font color=darkcyan>This Page  Will Refresh Every 60 seconds.</font></center>"));
          
         
          client.println(F("<hr />"));
          client.println(F("</body></html>"));


          readString=""; //clearing string for next read
          delay(2); //delay RX DATA
          client.stop(); //stopping client
          client.flush();
        }
      }
    }
  }
}

I tried adding the get ip code but get - get_ip:5: error: expected constructor, destructor, or type conversion before ‘.’ token
Not sure if it is the code or where i am putting it.

I tried adding the get ip code but get - get_ip:5: error: expected constructor, destructor, or type conversion before '.' token Not sure if it is the code or where i am putting it.

The code you posted goes not have a get_ip() function defined or called. Are we supposed to guess where you put it?