Your new topic does not fit any of the above??? Check first. Then post here. Thanks.

Moderator: igrr

User avatar
By eldonb46
#26789
martinayotte wrote:That is a bit strange, since both send() and sendContent() are in fact using _currentClient.write() internally, which should be equivalent to server.client().print().
Which version of ArduinoIDE are you using ?
When I get chances, I will dig the issue if IGRR doesn't have time either.


martinayotte, and all,

Any resolution on this yet?

I am using Arduino 1.6.5, with http://arduino.esp8266.com/stable/packa ... index.json

I have found the following two code lines have a significant performance differences, about 160 to 1.

Code: Select allint sentSize  = server.client().print(_WifiBuf.substring(0, 1460));

and
Code: Select allserver.sendContent(_WifiBuf.substring(0, 1460));


Maybe, I am using them wrong, or an improper configuration :-)

Also, I am wondering why "server.send()" and "server.sendContent()" were NOT implemented to return a Sent Count? A sentCount other than expected should be an error, but they both error silently.

Regards,
Eldon - WA0UWH
User avatar
By martinayotte
#26817 Hi eldonb46,

I've spend some time trying to reproduce the issue, but I wasn't able, the different in the timing I saw is not appreciable.

Here is the 2 callbacks I've used in the HelloServer :

Code: Select allvoid handleTest1() {
  int prevTime = micros();
  server.send(200, "text/plain", "hello TEST1 from esp8266!\r\nhello TEST1 from esp8266!\r\nhello TEST1 from esp8266!\r\nhello TEST1 from esp8266!\r\nhello TEST1 from esp8266!\r\nhello TEST1 from esp8266!\r\nhello TEST1 from esp8266!\r\nhello TEST1 from esp8266!\r\nhello TEST1 from esp8266!\r\nhello TEST1 from esp8266!\r\nhello TEST1 from esp8266!\r\nhello TEST1 from esp8266!\r\nhello TEST1 from esp8266!\r\nhello TEST1 from esp8266!\r\nhello TEST1 from esp8266!\r\nhello TEST1 from esp8266!\r\nhello TEST1 from esp8266!\r\nhello TEST1 from esp8266!\r\nhello TEST1 from esp8266!\r\nhello TEST1 from esp8266!\r\nhello TEST1 from esp8266!\r\nhello TEST1 from esp8266!\r\nhello TEST1 from esp8266!\r\nhello TEST1 from esp8266!\r\nhello TEST1 from esp8266!\r\nhello TEST1 from esp8266!\r\nhello TEST1 from esp8266!\r\nhello TEST1 from esp8266!\r\nhello TEST1 from esp8266!\r\nhello TEST1 from esp8266!\r\nhello TEST1 from esp8266!\r\nhello TEST1 from esp8266!\r\nhello TEST1 from esp8266!\r\nhello TEST1 from esp8266!\r\nhello TEST1 from esp8266!\r\nhello TEST1 from esp8266!\r\nhello TEST1 from esp8266!\r\nhello TEST1 from esp8266!\r\nhello TEST1 from esp8266!\r\nhello TEST1 from esp8266!\r\nhello TEST1 from esp8266!\r\nhello TEST1 from esp8266!\r\nhello TEST1 from esp8266!\r\nhello TEST1 from esp8266!\r\nhello TEST1 from esp8266!\r\nhello TEST1 from esp8266!\r\nhello TEST1 from esp8266!\r\nhello TEST1 from esp8266!\r\nhello TEST1 from esp8266!\r\nhello TEST1 from esp8266!\r\nhello TEST1 from esp8266!\r\n");
  int duration = micros() - prevTime;
  Serial.println(String("test1 duration = ") + duration);
}

void handleTest2() {
  int prevTime = micros();
  server.client().print( "HTTP/1.1 200 OK\r\nContent-Type: text/plain\r\n\r\n" );
  server.client().print("hello TEST2 from esp8266!\r\nhello TEST2 from esp8266!\r\nhello TEST2 from esp8266!\r\nhello TEST2 from esp8266!\r\nhello TEST2 from esp8266!\r\nhello TEST2 from esp8266!\r\nhello TEST2 from esp8266!\r\nhello TEST2 from esp8266!\r\nhello TEST2 from esp8266!\r\nhello TEST2 from esp8266!\r\nhello TEST2 from esp8266!\r\nhello TEST2 from esp8266!\r\nhello TEST2 from esp8266!\r\nhello TEST2 from esp8266!\r\nhello TEST2 from esp8266!\r\nhello TEST2 from esp8266!\r\nhello TEST2 from esp8266!\r\nhello TEST2 from esp8266!\r\nhello TEST2 from esp8266!\r\nhello TEST2 from esp8266!\r\nhello TEST2 from esp8266!\r\nhello TEST2 from esp8266!\r\nhello TEST2 from esp8266!\r\nhello TEST2 from esp8266!\r\nhello TEST2 from esp8266!\r\nhello TEST2 from esp8266!\r\nhello TEST2 from esp8266!\r\nhello TEST2 from esp8266!\r\nhello TEST2 from esp8266!\r\nhello TEST2 from esp8266!\r\nhello TEST2 from esp8266!\r\nhello TEST2 from esp8266!\r\nhello TEST2 from esp8266!\r\nhello TEST2 from esp8266!\r\nhello TEST2 from esp8266!\r\nhello TEST2 from esp8266!\r\nhello TEST2 from esp8266!\r\nhello TEST2 from esp8266!\r\nhello TEST2 from esp8266!\r\nhello TEST2 from esp8266!\r\nhello TEST2 from esp8266!\r\nhello TEST2 from esp8266!\r\nhello TEST2 from esp8266!\r\nhello TEST2 from esp8266!\r\nhello TEST2 from esp8266!\r\nhello TEST2 from esp8266!\r\nhello TEST2 from esp8266!\r\nhello TEST2 from esp8266!\r\nhello TEST2 from esp8266!\r\nhello TEST2 from esp8266!\r\nhello TEST2 from esp8266!\r\n");
  int duration = micros() - prevTime;
  Serial.println(String("test2 duration = ") + duration);
}


And here are the result shown on Serial for the timing measurement in microseconds done using Firefox browser on my Ubuntu :
Code: Select allConnected to Giroles-Salon
IP address: 10.111.111.69
MDNS responder started
HTTP server started
test1 duration = 6387
test2 duration = 5695
test1 duration = 5839
test2 duration = 4142
test1 duration = 4263
test2 duration = 3742
test1 duration = 7354
test2 duration = 5679
test1 duration = 6580
test2 duration = 4577


So, it is not even 2-1, and far from 160-1 ... There must be another issue in your setup ... :(

For the "sent count", yes, I saw that yesterday when looking at the code. I will check if it can be enhanced easily, and if IGRR and Makuna agree for such changes.
User avatar
By RichardS
#26819 Just curious, try and small packet! Maybe 32 bytes....

Wondering.....

Richard.
User avatar
By martinayotte
#26824 Nope, still the same ...

Code: Select alltest1 duration = 4982
test2 duration = 3124
test1 duration = 3713
test2 duration = 3929
test1 duration = 4057
test2 duration = 3962


But although those measurements are done from ESP side, I've noticed that Firefox was actually slower to display final content during TEST2 (blank page for nearly 1 sec), while TEST1 was instantaneous, which is the reversed than expected. I think it is waiting for a connection close, I added a "Connection: close" in the header, but it didn't help, I added a flush(), but it didn't help either. Putting back the long string, both were fine again ... :o