Ethernet client stop

Hi, I was wondering, if this...

      client.setConnectionTimeout(100);
      while (true) {
        if (client.connect(server, port)) {
          client.write(data, sizeof(data));
          if (client.connected())
            client.stop()
        }        
      }

or this...

      while (true) {
        if (client.connect(server, port)) {
          client.write(data, sizeof(data));
        }
      }

... is used. Will there be a memory leak cause of no stopping / stopping might not finished in time), or will a new connection only take place if the old is remove correct (from memory)?

Background: I want to send data to a server, but have to return to collection data asap, so wasting a lot of time with waiting for connection things aren't a good option. Having a memory leak either.

sens makes

if (!client.connected()) {
  client.connect(server, port)
}

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