Using multiple EthernetClient

I think I am having a brain dead moment.
I am trying to access 8 Ethernet Clients in a loop using a Uno and a W5500 ethernet shield.
I have set everything up (obvious stuff omitted) eg:
EthernetClient client1;
EthernetClient client2;
EthernetClient client3;
EthernetClient client4;
EthernetClient client5;
EthernetClient client6;

I can access each client using, etc but I want to access them all using a 'for' loop. eg:
for (i = 0; i < 6; i++) // 6 clients to access
for (a = 0; a < 10; a++) // 10 bytes to read
array[(i * 10) + a] = client'i'.read(); // 60 byte array, 10 per client
I know there is no such thing as "client'i'" but I am just using it as a guide.
How do I change the client number to match the 'i'??? Can I do it using socket numbers???
(yes I know there are errors in the above example but I am only trying to get my meaning across)
Please help.

Hmmm, think about an array[ ] of clients…

client[i].read; and so on.

Interesting... I will give it a shot.


you want have 8 permanent connections?

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