Hi both,
I've red the iperf part in details. My issue is that having this iperf code seem the only way to get decent throughput.
I am simply trying to get a file from the web from an http get. Currently I hardly reach 1mbps, which is really low.
I am not expecting 20 or 30 Mbps, but at least 5-10Mbps at a minimum.
I get:
-buffersize 1000 - delay (to fill in the buffer) 1ms Throughput : 984 kbps
-buffersize 1000 - delay (to fill in the buffer) 2ms Throughput : 480 kbps
-buffersize 2000 - delay (to fill in the buffer) 1ms Throughput : 688 kbps
-buffersize 2000 - delay (to fill in the buffer) 2ms Throughput : 384 kbps
nzh912: have you succeeded to improve your throughput?
ESP_SPRiTE: would you be able to suggest something?
I am using the below code (based on StreamHttpClient.ino) - I have played with many buffer size and delay values. I don't need the data (just trying to measure bandwidth) so I could just through it away...
Code: Select all
#include <WiFi.h>
#include <HTTPClient.h>
bool GOTIP;
const char* ssid = "XXXXXXXX";
const char* password = "XXXXXXXX";
long speedtest(const int size) {
HTTPClient http;
const char* host = "http://ovh.net/files/10Mb.dat";
size_t count = 0;
unsigned long t_start;
unsigned long t_end;
Serial.print("connecting to "); Serial.print(host); Serial.print("\t");
Serial.println(http.begin(host));
int httpCode = http.GET();
unsigned long timeout = millis();
t_start = millis();
if (httpCode == HTTP_CODE_OK) {
int len = http.getSize();
count = len;
uint8_t buff[128] = { 0 };
WiFiClient * stream = http.getStreamPtr();
while (http.connected() && (len > 0 || len == -1)) {
size_t size = stream->available();
if (size) {
int c = stream->readBytes(buff, ((size > sizeof(buff)) ? sizeof(buff) : size));
//Serial.write(buff, c);
if (len > 0) {
len -= c;
}
}
delay(5);
}
t_end = millis();
Serial.print("\t\tThroughput :\t"); Serial.print(count / (t_end - t_start) * 8 ); Serial.print("\tkbps");
}
}
void setup()
{
Serial.begin(115200);
Serial.print("Connecting to "); Serial.println(ssid);
WiFi.begin(ssid, password);
while (WiFi.status() != WL_CONNECTED) {
Serial.print("."); delay(200);
}
Serial.print("WiFi connected with IP:"); Serial.println(WiFi.localIP());
speedtest(2000);
}
void loop() {}