EthernetClient not initializing properly
An EthernetClient expects to connect to a remote socket. At no point do you instruct it to connect to a socket, so it never succeeds.

At some point before checking for a connection you need to initiate that connection:

// arduino.cc is 100.24.172.113
IPAddress server(100, 24, 172, 113);
client.connect(server, 80);


The if (client) operation relies on sockindex having been assigned a valid value, and that is only ever done either by EthernetClient::connect() or by being explicitly set by EthernetServer::available().