How can I test the transfer speed between two ESP32 in a Wifi-Mesh

Hi all, i have a program that transfer data between two ESP32 in a wifi mesh, here is my code

#include "painlessMesh.h"

#define   MESH_PREFIX     "nghi123"
#define   MESH_PASSWORD   "nghi1234"
#define   MESH_PORT       5555

Scheduler userScheduler; // to control your personal task
painlessMesh  mesh;

// User stub
void sendMessage() ; 

Task taskSendMessage( TASK_SECOND * 1 , TASK_FOREVER, &sendMessage );

void sendMessage() {
  long time1=millis();
  String msg = "Hi from node1";
  msg += mesh.getNodeId();
  mesh.sendBroadcast( msg );
  taskSendMessage.setInterval( random( TASK_SECOND * 1, TASK_SECOND * 5 ));
  long time2=millis();

// Needed for painless library
void receivedCallback( uint32_t from, String &msg ) {
  Serial.printf("startHere: Received from %u msg=%s\n", from, msg.c_str());

void newConnectionCallback(uint32_t nodeId) {
    Serial.printf("--> startHere: New Connection, nodeId = %u\n", nodeId);

void changedConnectionCallback() {
  Serial.printf("Changed connections\n");

void nodeTimeAdjustedCallback(int32_t offset) {
    Serial.printf("Adjusted time %u. Offset = %d\n", mesh.getNodeTime(),offset);

void setup() {

  mesh.setDebugMsgTypes( ERROR | STARTUP );  // set before init() so that you can see startup messages

  mesh.init( MESH_PREFIX, MESH_PASSWORD, &userScheduler, MESH_PORT );

  userScheduler.addTask( taskSendMessage );

void loop() {
  // it will run the user scheduler as well

I want to test the data transfer speed between two ESP-32 in this situation but i don't know any solutions, what should i do ? Thank you very much

You managed to add code as a codesection. OK one step forward.

From your other post quotation:

Hello everyone, I’m newbie. I have to write a program to transfer data between two ESP32 kit over local wifi and survey the transmission speed between two kits. But i don’t know how to survey the data transfer speed. Can anyone help me to solve this problem ? Thank you very much

I can conclude this is something you have to do for school.
I don't believe that all your teacher did was saying

"your homework is "test datatransfer-Speed in a ESP32-mesh"

so I'm very sure you have been given more information.
To give you more information about me:
I'm a somehow advanced hobbyprogrammer. I have done quite some projects with ESP32 but never a project that used a mesh. So I have no idea how using this library works.

I would have to do reading the documentation too.
The code you have posted is the code found here

where you just changed the mesh-prefix and mesh-password

If your mesh is build from just two ESP32 it is not really a mesh.

Think of much more basic things how would you measure transporting-time?

best regards Stefan