Shop OBEX P1 Docs P2 Docs Learn Events
Hit Counter for Spinneret — Parallax Forums

Hit Counter for Spinneret

doggiedocdoggiedoc Posts: 2,241
edited 2013-02-01 06:29 in Accessories
I've been giving some thought to a hit counter for pages served from a Spinneret. I tried some 'free counter' code from xyz.com or somewhere like that but I kept having problems with the way I wanted to implement it.

I saw some code Beau Schwabe did that count's visitors. the first hurdle I see is the variable that holds the count gets reset with reboots. Perhaps saving to SD or EEPROM and reloading would be a fix for that.

Anybody done this yet?

Paul

Comments

  • RforbesRforbes Posts: 281
    edited 2013-01-31 18:03
    Hey doggiedoc,

    I use the "I2C_ROMEngine" found on the OBEX with my SNTP object so that I can accumulate and totalize run times for various I/O pins and keep the data going through power cycles... works like a charm. I backup the data to an SD card as well.

    I imagine the same principle would work for you just as well.

    I'm thinking something like:
    PRI StaticFileHandler(id) | fileSize, i, headerLen, temp, j
      ''Serve up static files from the SDCard
      
      counter++
    

    would work, but that's not really a visitor count.... rather just a counter for every time someone requests anything at all from the server.
  • doggiedocdoggiedoc Posts: 2,241
    edited 2013-01-31 18:13
    Cool! That's just what I was getting at. I don't really need unique visitors. Just need a feel for volume of traffic.

    Thanks for the ROM tip.

    Paul
  • Mike GMike G Posts: 2,702
    edited 2013-02-01 06:29
    I capture the file name, request time, IP, and count on the SD card. I like looking up the IPs and finding the global locations where the requests originate. When I get home from work today, I'll post how to do this with the new W5200 code.

    doggiedoc, I'm putting together source for you to use on the InterCoop. I'd like to use this exercise as a tutorial for others.
Sign In or Register to comment.