Does Ethernet always need 2 sockets ?

I am using an ESP32 in combination with a W5500 and i am using the ethernet_generic.h library . (which has been archived, i suspect it is because esp32 core 3 does not need it nor can it be used)
While i am using Artnet over Ethernet i have run into the limitation of the hardware buffer size of the W5500. It has 32Kb memory divided into 16Kb for Rx & 16Kb for Tx, and somehow the minimum number of sockets is '2' Now why is that, i mean i can set it to '1' and test and see what happens i suppose, but if i connect my laptop directly to the W5500, how many sockets do i need ? Is there someone out there who can explain to me a bit more in detail. My google searches were not very successful, partly because i get information more about the physical socket, but that is a different matter.

I haven't used W5500 Ethernet myself but as for the socket part, 1 is enough for one client and at least 2 are needed for a server (one listening socket and at least one connection socket). If you want to run more (TCP) connections (or UDP, like NTP client for example) in parallel more sockets are required.

So reducing it to 1 socket i could not support a server ? Ok, but with 2 i can support a server and UDP reception at the same time. So i guess that UDP reception is stopped when the server needs the socket. (that is what is happening anyway as far as i can tell)

Now the W5500 appears to be dividing the buffer in equal parts, but i don't need a huge buffer for the server really.

The W5500 has 8 sockets. If a client is connected, there will be a socket for the client and one listening for a new connection.

That is the maximum number of sockets, like that the Rx buffer size is 2KB per socket. By reducing the number of sockets i can have 8KB per socket for 2 sockets. This suffices for receiving 16 ArtNet universes (almost though not quite, 1 packet is 530 bytes but if i am reading at time of reception, i can read the first before the last arrives) But i would like to be able to receive more of them, and i somehow don't appear to be able to read them quickly enough.
Therefore i was thinking to use just the 1 socket and not bother listening, running the webserver on WiFi only (or on a 2nd W5500, though i am not sure how to wire that. I don't want more than 1 RJ45 on the board.)

The maximum realistic packet size is 1460 bytes. The sender won’t send another packet until you read the previous packet and send an ACK.

That is not the case with UDP packets though, which is the packets i am receiving mainly.

Sounds like you need a more powerful processor to keep up.

How big are the UDP packets? How fast do they arrive? Where is the sender? Localnet or internet?

I interface the Mega2560 and w5100 shield and it keeps up with Flightgear flight simulator UDP.

530 bytes per packet.

32 packets per frame anywhere between 15 to 40 Hz though the framerate seems to be not affecting the reception much.

Direct LAN between the Laptop and W5500.

That is a consideration. I am using an ESP32, and receiving frames of 16 packets works Ok, though once i started halting the processor by writing to an SD card, the 16th frame was not always received properly. Shifted the SD writes to the other processor and added a 32 block buffer, and the problem was solved.

So then i decided that i could do something similar and receive the packets on the 2nd core, but that somehow didn't quite work. I do figure that a bigger hardware buffer would help.

The primary processor also has increased load from double the processing, and this probably needs to be addressed.

I am looking at optimizing the encoding, though a more obvious solution may be to let the 2nd core do that instead.

All in all it's not all that important, instead of a single 32 universe node, one could just use 2x 16 universe nodes.

I am just trying to squeeze as much out of the processor as possible, but maybe i have just gone over the limit.

I somehow doubt that is even remotely close to the amount of data i am working with.

You are correct. FlightGear data packets are small and requires very little processing.

Sounds like you need more power. I use the RPi Zero 2W when more power is required. At $18 it is a great upgrade. It’s wifi not ethernet, but very fast. Dual core.

Well i will stick to the ESP32 for now. I suspect i am doing something not quite right with using the 2nd core.

Does the ESP32 do much processing on the packets? If so, that can cause missed packets. Have you tried receiving the packets and send only the count on the serial port? That’s how I discovered my Mega wasn’t up to the task if much data processing was required.

Well yes a significant amount, there isn't 2 ways about that. So by letting the 2nd core do the reception and then pass the most recent version of the packets to the main core and do the processing. At least that was the train of thought. The 2nd core should not get distracted by the processing. But i am not sure if the processes are actually run on the other core. There is something about initiating the objects on 1 core and using them n the other.

The biggest proces that is being run is the encoding and it can be significantly time consuming. There may be a way to optimize it a bit though and that will also require some investigating.

I am not even sure that the SD writing i was doing in the 16 universe version is actually happening on the 2nd core or that the improvement was just the result of buffering. Really the overall speed of the writing was fine, but there were peaks in the write time that would exceed the frame rate.

back to this situation. I initiate the ethernet on the main core and there is a good chance that the task that uses it is running on that as well. I will need to look into how to actually verify what core is being used. And read up on it a bit again.

I am thinking of shelving it a it for now and get back to it later, though i am still going to fiddle with priority of the task a bit.