NANO check if its own web server is running

Hello everyone,

My first post so please do not be try not to be super harsh. If I posted in the wrong section I do apologize. I have not cross posted the question so that should be good.

I am working on a DIY IoT platform that uses the old Arduino Nano with a ENC28 shield. I have developed some interesting functionality already (I can change the behaviour and the settings of the "node' after it has been deployed out in the wild: send health data to IoT server, reverse relay ON / OFF behaviour if a relay module is attached, run a custom code block specific to a particular node hardware configuration etc). I figured out a way to keep the uptime in 100+ days etc All that good stuff. However there is one thing that keeps bugging me: How do I check if the web server on the Arduino is still running from the point of view of the Arduino? I am using the UIPEthernet library - not sure if that is a problem. The goal is to check every 5 minutes (I am using the so called "threads") if port 80 on the Nano board is still running / open, and if it is not => perform a restart of the node. I have attempted to use the connect function to connect to the node own IP address but that seems to have backfired maybe due to the single cpu... I actually do not know. I did see that if using the W5100 you can check the socket status or use the if(!server) line to see if the web server is still running and take action from there.

I am sorry if this has been a long read. If someone could point me in the right direction (or offer me a solution / idea) that would be great as my ignorance is ever expanding (at least that it how it seems).

Hope everyone is keeping safe.

Thank you in advance.

Regards
Matt

Hi,

For anyone who is interested I have been doing some tests (some stuff I found online) and reading the spec sheet of the ENC28J60 afterwards and I found two things that work when I crash my arduino by flooding it with packets. This is by no means my discovery / idea. However there are some really interesting things in the spec sheet giving you an insight to how stuff works on a lower level.

#define NET_ENC28J60_EIR          0x1C
#define NET_ENC28J60_EIR_RXERIF   0x01
#define NET_ENC28J60_ESTAT        0x1D
#define NET_ENC28J60_ESTAT_BUFFER 0x40

uint8_t stateEstatBuffer = Enc28J60.readReg((uint8_t) NET_ENC28J60_ESTAT) & NET_ENC28J60_ESTAT_BUFFER;
uint8_t stateEirRxerif = Enc28J60.readReg((uint8_t) NET_ENC28J60_EIR) & NET_ENC28J60_EIR_RXERIF;

if (stateEstatBuffer != 0 || stateEirRxerif != 0 )
{
   resetArduino();
}

The checks with the W5100 are super easy and obvious, but with the ENC28 it is a different ball game.

Hope this helps someone.