-->
Page 1 of 1

Wifi speed too low

PostPosted: Thu Feb 02, 2017 11:41 am
by Mohd Saood
Hello, I am working with ESP8266-12 with nodemcu firmware and trying to send data to my local server using TCP protocol. I wanted to test the wifi transfer rate with some test data and found speed to be too low (as low as 10KBps). The following is the code
Code: Select allprint(tmr.time());
data='123456789_123456789_123456789_123456789_123456789_123456789_123456789_123456789_123456789_123456789_';
length=1000;
check=(5+length*string.len(data));
conn=net.createConnection(net.TCP, 0);
conn:on("receive",  function(conn2,pl)
        print(pl);
        print(tmr.time());
        conn2:close();
        conn=nil;
        collectgarbage();
end);
str="POST /ml/index.php HTTP/1.1\r\nHost: "..serverip.."\r\nConnection: close\r\nContent-Length: "..check.."\r\nContent-Type: application/x-www-form-urlencoded\r\nAccept: */*\r\n\r\ndata=";
conn:on("sent",function(conn,c)
   if(length>0)then
      conn:send(data)
      length=length-1
   end
end);
conn:on("connection", function(conn,c)
   print('Conneted!')
   conn:send(str);
end);
conn:connect(port,serverip);

With this method I am getting bout 8-10KBps. Which is too low. Or Is there something wrong about the method I am using?

Re: Wifi speed too low

PostPosted: Sat Feb 04, 2017 5:31 pm
by g6ejd
To check things out, I would time your posted example then reduce the data by 50% and try/time it again to see if there is a speed difference and then repeat that test again with just 1 or 2 characters, ideally do a really short message, a medium message and a long one. If the results are broadly the same then it's down to slow LUA operation. If time does not improve with a shorter string then suspect LUA processing overhead, if no change then look for other factors like the link quality, try getting the ESP really close to the router.