EthernetClient in a struct

I'm trying to create an array of structs which have the 'EthernetClient' in it along with the IPAddress and some other bits, but I can't quite work out how to make it work
I have defined a struct:

typedef struct
{
  IPAddress       IPAddr;
  EthernetClient  client;
  bool            Active;
}Links_struct;

Now I need to create the array:

Links_struct Links[2]=
{//IPAddr,                           client,       Active
  {IPAddress ( 192, 168,   0, 100 ), ???????????,  false},
  {IPAddress ( 192, 168,   0, 101 ), ???????????,  false},
};

What I can't work out is what I need to put in place of the '?'s

Well, this works:

EthernetClient client[2];

Links_struct Links[2]=
{//IPAddr,                           client,                   Active
  {IPAddress ( 192, 168,   0, 100 ), EthernetClient client[0], false},
  {IPAddress ( 192, 168,   0, 101 ), EthernetClient client[1], false},
};

But is pretty horrible, there must be a better way?

Well, this works:

Are you actually able to use those clients? I can't imagine that you can.

Is that data for use on a client or server?

Only one of the servers is active, but it connects and gets a response from it.

PaulS:
Is that data for use on a client or server?

Not sure what you mean, the struct data is for use within the Arduino (I’ve cut the struct down for clarity, there’s more in there), which is the client to multiple telnet servers. The telnet servers are actually Ethernet controllable PSUs.

Not sure what you mean

If the Arduino is a server, then a client is one that has connected to the server, and is meaningless to store in a struct.

If the Arduino is client, the client object should exist only for the life of an interaction with a server. I can't see storing that in a struct, either.

The Arduino is the client of multiple telnet servers.
The use of struct lets me define all aspects of the server in an easy to read table, the code I have shown is a cut down version for clarity, there's a lot more in the struct and there are actually 6 servers which are being connected to. Having all aspects of the server in a struct seems sensible.

So, do we know of a way to define the clients within the struct? I can live with the solution I have but it is ugly.
I guess this would work:

Links_struct Links[2]=
{//IPAddr,                           client,                 Active
  {IPAddress ( 192, 168,   0, 100 ), EthernetClient client0, false},
  {IPAddress ( 192, 168,   0, 101 ), EthernetClient client1, false},
};

I guess this would work:

That creates a new EthernetClient object that is not connected to a server. I fail to see how such an object is useful. That is why I asked if it was. You still haven't answered that.

The object is extremely useful, I am connecting to 6 servers simultaneously, so I need an object for each connection.
Obviously in the provided code, the objects aren’t connected to servers, that happens elsewhere. All I need to know is the simplest and most readable way to implement the client object in my struct.

All I need to know is the simplest and most readable way to implement the client object in my struct.

Implement? Do you mean declare? Initialize?

Shall we try declare? clearly I'm not trying to initialize it.

Shall we try declare? clearly I'm not trying to initialize it.

Why can't you use NULL until you actually have a real client instance? It would be simpler if the struct contained a pointer to an instance, rather than an instance.

Simpler for who? Can what I'm asking be done or should I just use the ugly workaround?

Simpler for who?

You, of course.

typedef struct
{
  IPAddress       IPAddr;
  EthernetClient  *pClient; // I use p as a prefix to all pointers, as a reminder that the variable holds a pointer
  bool            Active;
}Links_struct;
Links_struct Links[2]=
{//IPAddr,                                    client, Active
  {IPAddress ( 192, 168,   0, 100 ), NULL, false},
  {IPAddress ( 192, 168,   0, 101 ), NULL, false},
};

Then, later, when you DO have a client object:

EthernetClient client = server.available();
Links[n].pClient = &client;

Perhaps some clarification on how I’m using it.
This is the first usage in the code: (note that this is a simplified version using my workaround)

for (int i = 0; i < 2; i++)
{
    Serial.println(String("Trying Link ") + i);
    if (Links[i].client.connect( Links[i].IPAddr, TelnetPort )) //TelnetPort is the same on all
    {
etc...

‘client’ should probably be called ‘server’, it’s a casualty of cut/paste.

Converting all my code to use pointers isn’t simpler for me really…

Converting all my code to use pointers isn't simpler for me really...

if (Links[i].pClient->connect( Links[i].IPAddr, TelnetPort )) //TelnetPort is the same on all

Was that really all that hard?

Well, hang on, there's a step missing. Where's the pointer come from? they are all NULL at this point...
What do I need to do before that to get the pointers setup? If it's another loop to set them up I may as well stick with my ugly workaround.

Well, I have simplified it slightly, and it does work:

EthernetClient c;

Links_struct Links[2]=
{//IPAddr,                           client,                   Active
 {IPAddress ( 192, 168,   0, 100 ), EthernetClient (c), false},
 {IPAddress ( 192, 168,   0, 101 ), EthernetClient (c), false},
};

I don't really even need to state 'EthernetClient' inside the struct.
The final step would be to remove 'EthernetClient c;' and allocate the appropriate block of data directly in the struct, which is the bit I can't figure out.