Sample code to reproduce reconnection issue

Questions specifically regarding the WiShield 1.0 family driver.

Re: Sample code to reproduce reconnection issue

Postby aerodyno » Sun Apr 04, 2010 9:16 pm

my site is still up, I think. http://embeddeton.appspot.com/testping
aerodyno
 
Posts: 65
Joined: Tue Aug 04, 2009 8:42 pm

Re: Sample code to reproduce reconnection issue

Postby GregEigsti » Mon Apr 05, 2010 7:56 am

Hrrrm, could not hit it with our without my WiServer changes. If you get a chance to try my changes let me know how it goes.

Greg
Check out the wiki!
uIP Stack Docs
Compatible Access Point List
WiShield user contrib branch - DNS, DHCP, AP Scanning, bug fixes, etc.
SlackLab.org - My geek projects blog.
User avatar
GregEigsti
 
Posts: 1067
Joined: Sun Aug 02, 2009 5:23 pm
Location: Sammamish WA USA (near Seattle)
  • Website

Re: Sample code to reproduce reconnection issue

Postby nimbusgb » Tue Apr 06, 2010 11:40 pm

GregEigsti I tried your updated code and it appears to break my link.

After a few page transmissions the page only 1/2 transmits.


>>> Hmmm I may have a code problem so for the moment disregard this <<<<<
nimbusgb
 
Posts: 25
Joined: Fri Mar 26, 2010 8:13 am

Re: Sample code to reproduce reconnection issue

Postby John_Ryan » Sat Apr 10, 2010 7:28 am

GregEigsti wrote:Ok, here are my changes and they should fix this problem. Although it looks like Aerodyno took his repro web site down and my site cannot be hit repeatedly with either the modified or unmodified WiServer code :(

I added one function, resetOnLostConnection(), to the WiServer class and it is called (in the background) from WiServer.server_task(). So the fix, if it does indeed work, should not require any addition to your sketches.

This post has a zip attached to it which needs to be unzipped; the zip contains two files, WiServer.h/.cpp which should be copied over your existing copies in your libraries/WiShield directory.

Let me know if this helps (or not)!

Greg


I've tested your fix Greg and I am delighted to say it works!

I updated the WiServer files with those from the zip you've kindly provided in this thread. I deleted the O files then restarted the Arduino IDE. I then recompiled the ymicros gauges sketch and uploaded it to the board.

After a couple of URL tests I switched off the AP, waited 5 minutes, observed the WiFi LED go off, then switched the AP back on again a few minutes later. The board reconnected to the AP after the usual 35 seconds, and the sketch resumed like nothing had happened. :P

Earlier in the day I tested the "hruska" fix from this thread and unfortunately the results were not so good:-

http://asynclabs.com/forums/viewtopic.php?p=864#p864

I did the same as above with the addition of modifying the sketch per the instructions, the board did reconnect, but then after 3 or 4 minutes it disconnected itself, then reconnected itself.

The URL command interpreter tests all failed, and the visitor count had reset itself. The results then started getting really weird, my "? command interpreter started displaying junk on screen and mySql updates were not being executed. I managed to grab this browser code rendering before pulling the plug.

Anyway, thanks again for your fix, I hope they add it to the WiShield download so others can benefit from it also.

Code: Select all
GET /?ardu HTTP/1.1�
Host: www.ymicros.com�
User-Agent: Mozilla/5.0 (Macintosh; U; PPC Mac OS X Mach-O; en-US; rv:1.8.1.12) Gecko/20080201 Firefox/2.0.0.12 GTB5 FBSMTWB�
Accept: text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5�
Accept-Language: en-us,en;q=0.5�
Accept-Encoding: gzip,deflate�
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7�
Keep-Alive: 300�
Connection: keep-alive�

������p-alive

��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������HTTP/1.0 200 OK

<html>³</html>

John_Ryan
 
Posts: 155
Joined: Thu Jun 04, 2009 11:24 pm

Re: Sample code to reproduce reconnection issue

Postby GregEigsti » Sat Apr 10, 2010 8:58 pm

arlier in the day I tested the "hruska" fix from this thread and unfortunately the results were not so good

As stated earlier he has 1/2 the fix (or at least not the complete fix for this particular issue). Setting the active member variable (in the *request classes) was the other part of the equation. Since the reset occurs in the WiServer class and active has to be set to false in the *request classes (and they are loosely coupled if at all) its kind of a bandaid. I was just happy to get this working without requiring sketch modification/code.

I did the same as above with the addition of modifying the sketch per the instructions, the board did reconnect, but then after 3 or 4 minutes it disconnected itself, then reconnected itself.

Yeah, if you take a look at his async_init function you'll spot a bug pretty quickly that causes a complete reset to occur every time that you call it; regardless of that second param that says whether or not to reset (if I am remembering correctly).

THANKS for taking a look and getting back! So ends this foray into WiServer and back to the TCP/UDP code that I like to play with! :lol:

Greg
Check out the wiki!
uIP Stack Docs
Compatible Access Point List
WiShield user contrib branch - DNS, DHCP, AP Scanning, bug fixes, etc.
SlackLab.org - My geek projects blog.
User avatar
GregEigsti
 
Posts: 1067
Joined: Sun Aug 02, 2009 5:23 pm
Location: Sammamish WA USA (near Seattle)
  • Website

Re: Sample code to reproduce reconnection issue

Postby John_Ryan » Sat Apr 10, 2010 11:35 pm

GregEigsti wrote:
THANKS for taking a look and getting back! So ends this foray into WiServer and back to the TCP/UDP code that I like to play with! :lol:
Greg


You're most welcome, and that you fixed such a monumental-pain-in-the-butt problem is a truly grand accomplishment - a wireless device isn't really "wireless" if it needs to be manually reset when a connection drops, and fixing that widens the useful scope of the board to include hard core scientific and industrial applications :ugeek:

Will you be taking steps to ensure it's included in the distro? The Async guys should be throwing a party in your honor, seriously, good work!
John_Ryan
 
Posts: 155
Joined: Thu Jun 04, 2009 11:24 pm

Re: Sample code to reproduce reconnection issue

Postby aerodyno » Fri Apr 16, 2010 10:01 am

Hi guys,

After a bit of a hiatus I'm back to fixing this problem. Excited to hear that it worked in John_Ryan's case! John, were you uploading every x seconds or just using WiShield as a webserver?

So Greg, I'm not quite sure how this works -- did you use PART of the Hruska code + your code, or just virgin asynclabs code + your code?

I am going to be testing this again tonight and tomorrow. I still haven't found a way to do it without tracking download and upload times, which is not the best solution. I am amazed at how many different versions of the wishield library I have had to create for testing / my own purposes / etc. :)

-s
aerodyno
 
Posts: 65
Joined: Tue Aug 04, 2009 8:42 pm

Re: Sample code to reproduce reconnection issue

Postby hruska » Fri Apr 16, 2010 10:16 am

I'm glad we've finally got some more people stirring this pot. Thanks for all the additional insight, ideas, and fixes - this is the way this open source stuff is supposed to work :)
hruska
 
Posts: 13
Joined: Thu Nov 12, 2009 10:53 pm

Re: Sample code to reproduce reconnection issue

Postby GregEigsti » Fri Apr 16, 2010 10:34 pm

So Greg, I'm not quite sure how this works -- did you use PART of the Hruska code + your code, or just virgin asynclabs code + your code?

Based upon experience with a similar problem I sat down and made what I thought was the fix (without first looking at hruska's fix) - that ended up being the "same" as what hruska wrote up - well pretty much the same. I did not want to look at his code first, so I could compare and see how the approaches differed - and I was surprised at how close they were ;)

After testing with your repro case it was still botched and that is when I added the second part to set active to false on re/init - which seems to work. Most of the time that I worked on this was trying to smoosh it all into WiServer so that it was transparent to your sketch.

I started with a fresh d/l of the AsyncLabs code off of GitHub.

Glad its working!
Check out the wiki!
uIP Stack Docs
Compatible Access Point List
WiShield user contrib branch - DNS, DHCP, AP Scanning, bug fixes, etc.
SlackLab.org - My geek projects blog.
User avatar
GregEigsti
 
Posts: 1067
Joined: Sun Aug 02, 2009 5:23 pm
Location: Sammamish WA USA (near Seattle)
  • Website

Re: Sample code to reproduce reconnection issue

Postby John_Ryan » Sat Apr 17, 2010 3:21 pm

aerodyno wrote:..John, were you uploading every x seconds or just using WiShield as a webserver?
-s


My apologies for the late reply I've only just spotted your question.

The shield was configured as a WiServer, and at that stage of testing I hadn't altered the gauges sketch which had been working fine for several weeks. The sketch interprets basic URL commands, then executes POSTrequest's to a php script with URL parameters depending on what the visitor enters in the browser.

After implementing Greg's fix, and running the AP on/off tests which were successful, I subsequently added the GETrequest which retrieves atomically calibrated date and time data from a .txt file hosted on a remote Linux server every 30 seconds.

I'm just about to change that and the php script will instead post the date and time data to the Wishield (if it's online) as URL parameters, and I will no longer be needing to use GETrequest's.

..
John_Ryan
 
Posts: 155
Joined: Thu Jun 04, 2009 11:24 pm

PreviousNext

Return to WiShield 1.0 Driver

Who is online

Users browsing this forum: No registered users and 1 guest