2015-05-04 07:39 PM
Hello there, again,
I am trying to query the MCU over WiFi module, using ajax GET requests sent by a browser. The idea is: upon detecting the ''+WIND:56:Insert message to client: '' response, MCU responds appropriately, and this cycle repeats itself periodically.I've noticed that a sizable number of GET requests is being rejected or there is no response, especially if the period between sending the requests is less than 500 ms.I should also say that every request from the browser is sent only after some kind of response from to the previous request, so it never happens that there is more than one pending request.With 750 ms between ajax requests, it works okay, but I was hoping to do better. What are your experiences regarding this type of communication, aka constant polling of input.cgi?P.S. I am using input.cgi and ouptut.cgi as means of communication and data exchange between the MCU and the browser, but if you feel there is a better way, do tell :) #input-cgi2015-05-05 02:04 AM
Hi Marko,
what you are experiencing is well known,Since there is not a lot of RAM inside the module (we are talking about 20Kb, more or less) in ''idle'' state, you can not hold down F5 key on browser.When RAM goes down to 8Kb, incoming connection is rejected.Please note that 12 seconds are needed to clear http state after connection is closed. This is called time_wait state.This is what happened till FW3.3.xFrom FW3.4 on, there is a variable called ''ip_wait_timeout'' (default is 12 secs).Set this variable to a lower value to speedup RAM clean. I expect this improves your polling application.Hope it helpsjerry2015-05-05 02:37 AM
Hey Jerry,
Thanks very much for your prompt response!I am assuming that is the configuration variable.What would you say is the acceptable low limit for this ''ip_wait_timeout'' variable?Thanks!2015-05-05 03:00 AM
Yes, it's a new config var.
There is no a low good value. I mean, that value should be higher and higher. Google for ''timewait state''.You can start from default 12s, and half this value (6, 3, etc) till you reach a good value (for your polling application).Thanks to you.j2015-05-05 03:15 AM
Ok, thanks, I'll do just that :D
Btw, if you don't mind, let me hijack my own thread for just one more question, related to this.Sometimes, the loading of the pages is really slow, sometimes it's really fast. Are you famililar with this? Is there anything I can do do make it reliably faster?Thanks very much!2015-05-05 03:55 AM
I think it is the same problem.
Is there is enough RAM, connection is accepted, and web server is able to reply. If not so, connection is aborted, and browser needs to perform a new query later.To help internal webserver, avoid (limit the number of) nested HTML pages. Every page/object is an HTTP Get Request, and, so, an HTTP Connection (stored for time_wait time)j2015-05-05 04:07 AM
Ah, I see! Will keep it in mind, thanks!
2015-05-08 07:23 AM
Hi again,
I just noticed that, actually, setting the ''ip_wait_variable'' doesn't seem to work!Here's what I am sending to the module:AT+S.SCFG=ip_wait_timeout,6<CR>(to shorten the wait state to 6s)Firmware version is 3.4 (150331-4db547e-SPWF01S)I am receiving:ERROR: Unrecognized keyWhat could've gone wrong?2015-05-08 08:37 AM
Marko,
first of all, that value should be in milliseconds. Default is 12000. If you want to set as 6 seconds, 6000 is needed.Then, FW3.4 is 150410-c2e37a3.Where did you get your (150331-4db547e) release?j2015-05-08 09:39 AM
Ah, I see, thanks!
I got it from the contact from ST upon request, about a couple of weeks ago. Should I switch to different version?