Out of connecting Modbus TCP / IP

@ Reinhard Ostermeier - The problem may be due to the application made have exhausted system ressources ?
because it is strange that the problem occurs every time at the same time

Possible, do you have other tasks running on the device? Can you deactivate them temporarily?

I guess filePutContents writes to SD card.
I would start commenting this line out and see what happens.

@ Reinhard Ostermeier - Yes !

     private static void filePutContents(string path, string contents)
        {
            string rootDirectory = VolumeInfo.GetVolumes()[0].RootDirectory;
            FileStream fHandle = new FileStream(rootDirectory + path, FileMode.Create);

            byte[] data = Encoding.UTF8.GetBytes(contents);

            fHandle.Write(data, 0, data.Length);
            fHandle.Close();
        }

@ Reinhard Ostermeier - I feel that the problem would come well away line in question

? :think:

@ Reinhard Ostermeier - I put comment out the following line of code:

 //   filePutContents(@ "\TESTFILE" + Jour + Mois + Annee + ".txt", write);

Since the problem seems solved saw me there since this morning I’m running or 4000s before that cut 749S.

How come this is the writing on the microSD card that creates dysfunction

@ MVeloso4 - If you serach through out the Forum on the Topic SD Card, you will see several Topics about the Performance and reliability of SD Card.
I would recommend to perform SD card writing in a different thread, and use a queue (of strings in you case) which get written when time is available.

@ Reinhard Ostermeier - would it be possible to guide me in the establishment of a queue because it is the first time I expect about?

@ andre.m -

public void ThreadQueue()
        {
            while (true)
            {
                
                    lock (MyQ.SyncRoot)
                    {    
                        foreach (string item in MyQ)
                            {
                                filePutContents(@ "\TESTFILE" + Jour + Mois + Annee + ".txt", item); 
                            }
                        
                    }
            }

        }

Does the use of the queue is good?

@ MVeloso4 - You solution would block the insertion into the queue until everything is written. And you do not remove anything from the queue.
Also a try/catch is very important in an thread procedure, specially when working with files.
I would do as follows:

Inserting:

lock(MyQ.SyncRoot)
{
   MyQ.Enqueue(item);
}

Writing to file (dequeu):

void ThreadQueue()
{
   while(true)
   {
      string item = null;
      lock(MyQ.SyncRoot)
      {
         if(MyQ.Count > 0)
         {
            item = (string)MyQ.Dequeue();
         }
      }
      // writing to file is done outside of the lock!
      if (item != null)
      {
         try
         {
            filePutContents(@ "\TESTFILE" + Jour + Mois + Annee + ".txt", item); 
         }
         catch(Exception ex)
         {
            //TODO: handle exception here (or ignore it)
         }
      }
      Thread.Sleep(100); // wait 100ms before next write to reduce system load
   }
}