I am trying to implement a sketch using a esp8266 como servidor
, I need to send a string to the client and for that I am using this piece of code:
char sbuf[] = "Hello world!\n\r";
size_t len = strlen(sbuf);
for (i = 0; i < MAXCLIENTS; i++) {
if (serverClients[i] && serverClients[i].connected()) {
serverClients[i].write((char*) &sbuf, len);
delay(1);
}
}
Everything funciona OK
and the client can receive the characters, now I want to do una funcion
this so I can call it when I need it, so I have tried to implement my function:
void sendDataToClient( char *sbuf[]) {
size_t len = strlen(sbuf) + 1;
for (i = 0; i < MAXCLIENTS; i++) {
if (serverClients[i] && serverClients[i].connected()) {
serverClients[i].write((char*) &sbuf, len);
delay(1);
}
}
}
and so I am llamando a la funcion
:
char bufferMSGtoClient[] = "Hello world!\n\r\0";
sendDataToClient(bufferMSGtoClient);
But this no funcion
, the client does not receive anything, could someone tell me what myerror?