1-For the construction of the packet: '>3H 2B 2H' is it the transaction ID ?
2-I didn't understand how to Calculate receipt packet buffer and structure
3-if we supposed that "data" is all the packet , the first index of the data message will be 9 ( supposing that sizeof(int)=4 bytes) why is the index of L equal to 13 ? same question for 14,15 and 16 .
I think data is an array variable that we are filling with the content of registers , each register is 2 bytes.
And we know that the size of the data ( I mean the message) is 4 bytes.
I'm getting confused !
In this case you should not post short excerpts of that code but either post the complete code or provide a link to it.
That's python code and it hand codes complete ModBus messages (including CRC) which is definitely nothing you should take as a good example. There are libraries for the Arduino platform that handles the ModBus TCP protocol, so you should have a register description of your device, the rest is calling the library appropriately.