How to run client.write in void coop

I can run the command in the Void setup with Client.write as my scrip showing but it just 1 time for command running. in my project the command need to running every 1 minute in Void loop but I can't do that due to when I put Client.write in Void loop the process can't work so can any one advise me. Thanks.

#include "SPI.h"
#include "Ethernet.h"
byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED };
char server[] = "xxxxxx.dysdns.org";    // name address for Google (using DNS)
IPAddress ip(192, 168, 1, 17);
char command []= {"i20101"};


EthernetClient client;

void setup() {
  
  Serial.begin(9600);
  while (!Serial) {
  
  }
 
  if (Ethernet.begin(mac) == 0) {
    Serial.println("Failed to configure Ethernet using DHCP");
    
    Ethernet.begin(mac, ip);
  }
 
  Serial.println("connecting...");

 
  if (client.connect(server, 10001)) {
    Serial.println("connected");
    client.write(command);
    Serial.write(command);
} else {
Serial.println("connection failed");
}
}
  


void loop()
{
if (client.available()) {
char c = client.read();
Serial.print(c);
}

if (!client.connected()) {
Serial.println();
Serial.println("disconnecting.");
client.stop();
for(;;)
;
}
}

What do you mean it doesn't work? What happens? How does that compare with what you expected?

Hi Delta_G

See as my code that put the client.write in Void loop and see as serial monitoring that don’t have any feedback data from server. Thanks.

/*
* Simple Client to display IP address obtained from DHCP server
* Arduino 1.0 version
*/
#include "SPI.h"
#include "Ethernet.h"
byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED };
char server[] = "xxxxxxxxxx.dyndns.org";    // name address for Google (using DNS)
IPAddress ip(192, 168, 1, 17);
char command []= {"i20101"};


EthernetClient client;

void setup() {
  
  Serial.begin(9600);
  while (!Serial) {
  
  }
 
  if (Ethernet.begin(mac) == 0) {
    Serial.println("Failed to configure Ethernet using DHCP");
    
    Ethernet.begin(mac, ip);
  }
 
  Serial.println("connecting...");

 
  if (client.connect(server, 10001)) {
    Serial.println("connected");
   
    
} else {
Serial.println("connection failed");
}
}
  


void loop()
{
client.write(command);
Serial.write(command);
delay(10000);
if (client.available()) {
char c = client.read();
Serial.print(c);
}

if (!client.connected()) {
Serial.println();
Serial.println("disconnecting.");
client.stop();
for(;;)
;
}
}

for(;;)
;

Change this to :

for(;;)
Serial.print("Help, I'm stuck");

and see what happens.
See if you are getting stuck there losing connection.