# HTTP server on ESP32-P4-ETH over Ethernet

**URL:** <https://forum.arduino.cc/t/http-server-on-esp32-p4-eth-over-ethernet/1422944>\
**Category:** Programming\
**Created:** [January 1, 2026, 5:40pm UTC](https://forum.arduino.cc/t/http-server-on-esp32-p4-eth-over-ethernet/1422944 "2026-01-01T17:40:28Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![chrissaich](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/chrissaich/32/1126741_2.png) [@chrissaich](https://forum.arduino.cc/u/chrissaich)\
**Post date:** [January 1, 2026, 5:40pm UTC](https://forum.arduino.cc/t/http-server-on-esp32-p4-eth-over-ethernet/1422944/1 "2026-01-01T17:40:28Z")

</div>

I’ve previously written code to use an ESP32 board as a simple HTTP POST server which works fine except for the unreliability of WiFi, so I’ve bought an ESP32-P4-ETH with an onboard Ethernet phy.

Using examples, I can get this to connect to my network and respond to ping etc., but can’t figure out how to get it to hear and respond to a POST message.

The working code from the Wifi board is shown below. I’ve stripped out all of the stuff which I don’t think is needed to help me with my problem;

Any help greatly appreciated.

```arduino
#include <WiFi.h>

WiFiServer Server(80);

void loopHTTP()
{
  char postMsg[128] = "";
  int i=0;
  WiFiClient loxListen = Server.available();
  if (loxListen) 
  {
    boolean currentLineIsBlank = true;
    while (loxListen.connected()) 
    {
      while(loxListen.available()) 
      {
        
        char c = loxListen.read();
        if (c == '\n' && currentLineIsBlank) 
        {
          while(loxListen.available())
            postMsg[i++] = loxListen.read();
          ProcessReceivedMessage(); //Process the received message
          loxListen.println("HTTP/1.0 200 OK");
          loxListen.println("Content-Type: text/html");
          loxListen.println();
          loxListen.println("<HTML><BODY>OK</BODY></HTML>");
          loxListen.stop();
        }
        else if (c == '\n')
          currentLineIsBlank = true;
        else if (c != '\r') 
          currentLineIsBlank = false;
      }
    }
  }
}

void setup() 
{
  WiFi.begin("myssid", "mypassword");
  Server.begin();
}
  
void loop() 
{
  loopHTTP();
  delay(100);
}

```

---

<div class="post-metadata">

**Author:** ![Juraj](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/juraj/32/238785_2.png) [@Juraj](https://forum.arduino.cc/u/Juraj)\
**Post date:** [January 2, 2026, 7:32am UTC](https://forum.arduino.cc/t/http-server-on-esp32-p4-eth-over-ethernet/1422944/2 "2026-01-02T07:32:59Z")

</div>

> <https://github.com/Networking-for-Arduino/EthernetESP32/blob/master/examples/HelloServer/HelloServer.ino>

---

<div class="post-metadata">

**Author:** ![chrissaich](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/chrissaich/32/1126741_2.png) [@chrissaich](https://forum.arduino.cc/u/chrissaich)\
**Post date:** [January 3, 2026, 1:23pm UTC](https://forum.arduino.cc/t/http-server-on-esp32-p4-eth-over-ethernet/1422944/3 "2026-01-03T13:23:28Z")

</div>

Juraj, thanks for the reply. That has got me up and running. I had to change ethernet phy pins in EMACDriver.h line 43 to

`EMACDriver(EthPhyType phyType, int mdcPin = 31, int mdioPin = 52, int powerPin = 51, emac_rmii_clock_gpio_t clockPin = 50, emac_rmii_clock_mode_t clockMode = EMAC_CLK_EXT_IN);`

and make a few changes to HelloServer.ino but got there quite quickly.

I can post my working example if anyone would like it.

Thanks again

---

<div class="post-metadata">

**Author:** ![Juraj](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/juraj/32/238785_2.png) [@Juraj](https://forum.arduino.cc/u/Juraj)\
**Post date:** [January 3, 2026, 5:28pm UTC](https://forum.arduino.cc/t/http-server-on-esp32-p4-eth-over-ethernet/1422944/4 "2026-01-03T17:28:14Z")

</div>

those are default values for the parameters. don't change them.  
supply your settings in the sketch as constructor parameters

---

<div class="post-metadata">

**Author:** ![system](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/system/32/1140315_2.png) [@system](https://forum.arduino.cc/u/system)\
**Post date:** [July 2, 2026, 5:29pm UTC](https://forum.arduino.cc/t/http-server-on-esp32-p4-eth-over-ethernet/1422944/5 "2026-07-02T17:29:04Z")

</div>

Closed on July 2, 2026, 5:29pm UTC

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.
