Shop OBEX P1 Docs P2 Docs Learn Events
Spinneret Errors (Can't load page!) — Parallax Forums

Spinneret Errors (Can't load page!)

rapscaLLionrapscaLLion Posts: 75
edited 2012-12-06 18:48 in Accessories
Hi,

I'm using the latest (I think!) HTTPServer build, and am having trouble with serving simple pages. The Spinneret is connected via router to a closed wireless LAN, no WAN access. Desktop computers can access the Spinneret with seemingly no problem (which is to say that the page and contents display properly). An iPad running iOS 5 seems to be the same. However, an iPhone 4 running iOS 5 is extremely unreliable in accessing the pages. On rare occasion (I would guess once every forty or more attempts) I can get the whole page to load, more commonly (once every twenty attempts?) I get the partial page (which seems to be just the html, no images, css or js).

When I look at the PST results, I see that even when the page loads successfully on PC or iPad, there are timeouts seemingly at random. On the iPhone, in most cases there is nothing served and a single timeout appears in the PST as soon as the request is sent.

I am inclined to believe that it's not my htm/css/js/png files or code, since the extremely basic Serverbeer Hello World page exhibits the same problems

My config in the HTTPServer.spin is as follows:

mac byte $00, $08, $DC, $16, $F2, $6E
subnet byte 255, 255 ,255, 0
gateway byte 192, 168, 1, 1
ip byte 192, 168, 1, 150
port word 80
remoteIp byte 65, 98, 8, 151 {65.98.8.151}
remotePort word 80

The PST results are attached, with explanations of what's going on in each section. The ONLY code modified in the HTTPServer was the config setup as shown above.

Any thoughts?

EDIT: Same results on an alternate Spinneret unit and different ip/port settings.

Comments

  • WildatheartWildatheart Posts: 195
    edited 2012-03-21 09:54
    In your config settings you're using

    "remoteIp byte 65, 98, 8, 151 {65.98.8.151}"

    Didn't Mike G say 65.98.8.151 belong to Servebeer? If you google "whats my ip", your own Ip will be displayed. Try using that as your remoteIp.
  • rapscaLLionrapscaLLion Posts: 75
    edited 2012-03-21 10:17
    Since the network its on is NOT connected to the net (WAN), what ip should I use? I forgot to mention that I discovered a couple of my files were indeed out of date. They are now all up to date (it was interesting finding the SNTP library...). The results are still the same.

    The new config is as follows:

    mac byte $00, $08, $DC, $16, $F1, $E3 {$EF, $22 or $F1, $32}
    subnet byte 255, 255 ,255, 0
    gateway byte 192, 168, 1, 1
    ip byte 192, 168, 1, 152 {120 or 122}
    sntpIp byte 69, 25, 96, 13 {San Jose CA}
    port word 5000
    port2 word 5010
    remoteIp byte 65, 98, 8, 151 {65.98.8.151}
    remotePort word 80
    uport word 5050
  • Mike GMike G Posts: 2,702
    edited 2012-03-21 13:09
    What exactly are you troubleshooting? iPhone connectivity?

    Everything else is working?
  • WildatheartWildatheart Posts: 195
    edited 2012-03-21 13:14
    Just as I was asked:
    Post your running source code.
    Describe your connections.
    Yada, yada, yada...
    What URL are you typing into the browser address bar?

    Did I read correctly that your desktop and Ipad can access your Spinneret, and not your Iphone?

    Well, my older Ipad also takes several attempts to access my Spinneret, but it seems I just have to accept that.

    It might also help to tell us what router you're using and what changes you made to set it up.

    As in my recent attempts, persistence pays.
  • rapscaLLionrapscaLLion Posts: 75
    edited 2012-03-21 13:42
    At this time I'm troubleshooting iPhone connectivity. The iPad seems to work fine, as well as the desktop computer, however they both seem to have intermittent timeouts on nearly every refresh in the PST. The iPhone simply will not download the page and all its elements. It flat out refuses to load the .js or images now. It typically will not download the css. The weird thing is it would intermittently load the complete, functioning page the first time I fired up the Spinneret yesterday. This only happened 2 or 3 times, but has not happened since. The spinneret's performance seems to be degrading with time, even when absolutely no changes are made. I get the same problem with the iPhone on the "Hello World" test page (no external dependencies) and I have also tried setting the iPhone to send different browser headers (iPad header, Safari header, etc).

    The running source code is as current on the Spinneret Google code repository. The following is the DAT again, which contains the ONLY modified portion of code:

    DAT
    mac byte $00, $08, $DC, $16, $F1, $E3 {$EF, $22 or $F1, $32}
    subnet byte 255, 255 ,255, 0
    gateway byte 192, 168, 1, 1
    ip byte 192, 168, 1, 100 {120 or 122}
    sntpIp byte 69, 25, 96, 13 {San Jose CA}
    port word 80
    port2 word 81
    remoteIp byte 65, 98, 8, 151 {65.98.8.151}
    remotePort word 80
    uport word 5050
    emailIp byte 68, 6, 19, 4
    emailPort word 25
    sntpPort word 123
    status byte $00, $00, $00, $00
    rxdata byte $0[RxTx_BUFFER]
    txdata byte $0[RxTx_BUFFER]
    tempBuff byte $0[TEMP_BUFFER]
    fileErrorHandle long $0
    debug byte $0
    lastFile byte $0[12], 0
    closedState byte %0000
    openState byte %0000
    listenState byte %0000
    establishedState byte %0000
    closingState byte %0000
    closeWaitState byte %0000
    lastEstblState byte %0000
    lastEstblStateDebug byte %0000
    udpListen byte %0000
    tcpMask byte %1111
    udpMask byte %0000
    fifoSocketDepth byte $0
    fifoSocket long $00_00_00_00
    debugSemId byte $00
    debugCounter long $00
    stringMethods long $00
    closingTimeout long $00, $00, $00, $00
    udpLen long $00
    time byte "00/00/0000 00:00:00", 0
    httpDate byte "Wed, 01 Feb 2000 01:00:00 GMT", 0
    globalCache byte $0
    dynamicContentPtr long @txdata


    I'm attaching my main htm. The css and js are not included, but the js is the current minified jQuery build. Like I said however, the Hello World page with no dependencies is equally problematic.

    Currently it's all connected to a LinkSys WRT54GL running Tomato Version 1.27 firmware. I have tried it as DHCP and with static ip setups. No difference either way.

    Since the whole point of this project is for it to be accessed entirely on iPads/Pods/Phones, intermittent function is really not ideal. Also, there will be an AJAX component that will need to function reliably, and in a time sensitive manner. Besides, at this point I'm completely unable to load the page on the iPhone.

    Thanks a lot for your help thus far!
  • Mike GMike G Posts: 2,702
    edited 2012-03-21 14:07
    Being that I do not own an iPhone or iPad, so I can't be of much help.

    When I was creating HTTPServer, it was a lot of work to handle all the mainstream browsers. This was not an easy task. They all handle connections a bit differently. Some are inpatient and some are forgiving...

    It sounds like a little time patience is needed to figure out what's going on.

    I'm assuming that the iPhone and iPad are connecting over WiFi?
  • rapscaLLionrapscaLLion Posts: 75
    edited 2012-03-21 15:09
    That's right, WiFi connection for the iDevices. I would have thought that the code base for the iPhone/iPad Safari browsers would be similar but obviously not :(
    Like I said, iPad works fine (the page loads and functions, even though there are some timeouts in the PST). The iPhone's Safari debug hasn't been of much help, save to point out that it never downloads the .js file.

    I'm about to try the whole setup on a different wireless router, as for whatever reason I can't get the Spinneret to appear on the Linksys' device status list. I'll let you know how that goes, but I doubt its the problem since the iPad works...

    Thanks for your help!
  • Mike GMike G Posts: 2,702
    edited 2012-03-21 15:34
    I doubt it's the router configuration.

    How do you know the .js file does not download? Do you see the resource request? Are you getting a 404? What happens to the initial request? Do you have a copy of the request header?

    The best thing to do is create a simple test/logging app and start experimenting.
  • rapscaLLionrapscaLLion Posts: 75
    edited 2012-03-21 15:49
    It was not the router configuration. I know that the .js file doesn't download because js internal to the page fires, but fails due to the external js not being downloaded. This is the only useful feedback I've gotten from the iPhone Safari debug utility.

    I sometimes see the resource request, sometimes not. How might I be able to get a copy of the request header from the iPhone? I'd love to see it :)

    Interestingly I just discovered it works just fine on an iPhone 4S. All of the test phones are up to date with the latest iOS updates, so I'm not sure why 4S works and 4/3GS don't.
  • Mike GMike G Posts: 2,702
    edited 2012-03-21 16:47
    The header is available via the PST (Parallax Serial Terminal), if the request makes it that far. IIRC, uncomment the pst.str(@data) line in the main program loop. There's also socket status print statements for debugging. I believe I left all the debug stuff in the source for this kind of situation.

    Use a packet sniffer to see the data flying between the Spinneret and the other device by MAC address.

    I'm guessing the culprit has something to do with socket connections, the W5100, and the status register parser. I'm sure it can be fixed with a little patience and troubleshooting.
  • WildatheartWildatheart Posts: 195
    edited 2012-03-21 18:15
    Interesting... my Iphone 4S will access my Spinneret, but an Iphone 3 phone won't. Still having intermittent problems with my Ipad Safari 5, but I've accepted that.
  • Mike GMike G Posts: 2,702
    edited 2012-03-21 22:05
    This is a wonderful opportunity for an iPod, iPhone, or iPad user to take the reigns and figure out what the heck is going on.

    Do we have a taker?

    I'll gladly whip this thing into shape but I'm in the middle of a project. I will not have the time for several weeks. Plus someone would have to lend me an iDevice.

    BTW, my Android phone works great!
  • rapscaLLionrapscaLLion Posts: 75
    edited 2012-03-22 11:01
    Well I'm glad it's not just me, even though that does mean we have some sleuthing to do. I'll do whatever I can to help (testing, etc) but I'm afraid network protocols are way above me. Learning opportunity I guess :)

    Mike: The pst.str(@data) is not in the main loop, at least in the version I'm running (07/16/2011). Where can I put it where it will be useful? I'll see about setting up a packet sniffer and get back to you.

    Thanks for all the help guys!
  • rapscaLLionrapscaLLion Posts: 75
    edited 2012-03-22 13:11
    Okay, so here's what I've managed to work out from the packets.

    Here's the current setup:

    Linksys Router: 192.168.1.1
    Spinneret: 192.168.1.100 (port 80)
    iPhone: 192.168.1.181
    PC: 192.168.1.127

    For whatever reason, the iPhone 4 doesn't ever get to send a GET request because it can't ever find the server. This is the packet that shows up on page request:

    1 0.000000 Apple_20:1a:44 Broadcast ARP 60 Who has 192.168.1.100? Tell 192.168.1.181

    Then nothing. After a few seconds there's a flurry of activity between the PC on the network, the router and various external IP addresses. Not sure if it's related, and they never communicate with the iPhone.

    What this means to me (a complete layman) is that the router doesn't really know where the router is. I can not - and have not ever been able to - see the Spinneret in the device list (tried two different routers, with assigned IPs and DHCP). However, that theory doesn't make a whole lot of sense when I run the request from the PC. These are the packets I get with the PC:

    1 0.000000 Intel_a3:95:2b Broadcast ARP 42 Who has 192.168.1.100? Tell 192.168.1.127
    2 0.000737 Wiznet_16:f1:e3 Intel_a3:95:2b ARP 60 192.168.1.100 is at 00:08:dc:16:f1:e3
    (The GET request comes a few lines later)
    6 0.002215 192.168.1.127 192.168.1.100 HTTP 349 GET /test.htm?led=on HTTP/1.1
    (And the response shortly after)
    10 0.081910 192.168.1.100 192.168.1.127 HTTP 60 HTTP/1.1 200 OK (text/html)

    So why can my PC find the server as well as an iPad, and not the iPhone 4? Why does the router not show the Spinneret in the device list (even if I assign its MAC address to its ip)?

    Let me know if you need more complete copies of the logs.

    Thanks!
  • Mike GMike G Posts: 2,702
    edited 2012-03-22 20:33
    The command is
    pst.str(@rxdata)
    

    Am i'm pretty sure it exists in all version as I always have to use it but I'm often mistaken.
  • rapscaLLionrapscaLLion Posts: 75
    edited 2012-04-15 17:26
    Hi,

    Sorry for the absence, had to work on another project for a few weeks.

    So the pst.str(@rxdata) is not in the version of code I'm running, but I added it in under the if(debug) section of main.

    Here's a request from Chrome on a PC, which always loads the page without a problem:
    ----- Start of Request----------------------------
    FIFO[1] 00000001
    ID: 0
    Request Count     : 4545
    GET /index.htm
    3-14 2-14 1-14 0-17
    clsd open lstn estb clwt clng udps
    0000-0000-1110-0001-0000-0000-0000
    
    GET / HTTP/1.1
    
    Host: 192.168.1.100
    
    Connection: keep-alive
    
    Cache-Control: max-age=0
    
    User-Agent: Mozilla/5.0 (Windows NT 6.2) AppleWebKit/535.19 (KHTML, like Gecko)
     Chrome/18.0.1025.152 Safari/535.19
    
    Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
    
    Accept-Encoding: gzip,deflate,sdch
    
    Accept-Language: en-GB,en-US;q=0.8,en;q=0.6
    
    Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.3
    
    
    
    
    FIFO[0] 00000000
    

    Here's a few failed requests from Safari on iPhone 4g running iOS 5.1:
    ----- Start of Request----------------------------
    FIFO[1] 00000001
    ID: 0
    Request Count     : 4553
    3-14 2-14 1-14 0-18
    clsd open lstn estb clwt clng udps
    0000-0000-1110-0001-0000-0000-0000
    
    FIFO[0] 00000000
    * Timeout *
    
    ----- Start of Request----------------------------
    FIFO[1] 00000001
    ID: 0
    Request Count     : 4553
    3-14 2-14 1-14 0-18
    clsd open lstn estb clwt clng udps
    0000-0000-1110-0001-0000-0000-0000
    
    FIFO[0] 00000000
    * Timeout *
    
    ----- Start of Request----------------------------
    FIFO[1] 00000001
    ID: 0
    Request Count     : 4553
    3-14 2-14 1-14 0-18
    clsd open lstn estb clwt clng udps
    0000-0000-1110-0001-0000-0000-0000
    
    FIFO[0] 00000000
    * Timeout *
    
    ----- Start of Request----------------------------
    FIFO[1] 00000001
    ID: 0
    Request Count     : 4553
    3-14 2-14 1-14 0-18
    clsd open lstn estb clwt clng udps
    0000-0000-1110-0001-0000-0000-0000
    
    FIFO[0] 00000000
    * Timeout *
    

    I notice that the request count does not increment... what does that indicate?


    Now I've stated before that on RARE occasion, the page will load incompletely on an iPhone 4G or 3G, and even rarer still a complete page load will occur. However the AJAX on the page does not work as the connection doesn't seem to persist.

    Here is an extremely rare complete page load via iPhone in the iCab browser set to send a request header with "Mozilla" as the user agent. Not sure if this is related?
    ----- Start of Request----------------------------
    FIFO[1] 00000001
    ID: 0
    Request Count     : 4553
    GET /index.htm
    3-14 2-14 1-14 0-17
    clsd open lstn estb clwt clng udps
    0000-0000-1110-0001-0000-0000-0000
    
    GET / HTTP/1.1
    
    Host: 192.168.1.100
    
    User-Agent: Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_6_8; en) AppleWebKit/5
    33.16 (KHTML, like Gecko) Version/5.0 Safari/533.16
    
    Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
    
    X-Icm-A: icm-c
    
    Accept-Language: en-us
    
    Accept-Encoding: gzip, deflate
    
    Connection: keep-alive
    
    
    
    
    FIFO[0] 00000000
    * NO  POST *
    
    ----- Start of Request----------------------------
    FIFO[1] 00000001
    ID: 0
    Request Count     : 4554
    GET /style.css
    3-14 2-14 1-14 0-17
    clsd open lstn estb clwt clng udps
    0000-0000-1110-0001-0000-0000-0000
    
    GET /style.css HTTP/1.1
    
    Host: 192.168.1.100
    
    User-Agent: Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_6_8; en) AppleWebKit/5
    33.16 (KHTML, like Gecko) Version/5.0 Safari/533.16
    
    Accept: text/css,*/*;q=0.1
    
    Referer: http://192.168.1.100/
    
    X-Icm-A: icm-c
    
    Accept-Language: en-us
    
    Accept-Encoding: gzip, deflate
    
    Connection: keep-alive
    
    
    
    
    FIFO[0] 00000000
    * NO  POST *
    
    ----- Start of Request----------------------------
    FIFO[1] 00000001
    ID: 0
    Request Count     : 4555
    GET /jquery.jss
    3-14 2-14 1-14 0-17
    clsd open lstn estb clwt clng udps
    0000-0000-1110-0001-0000-0000-0000
    
    GET /jquery.jss HTTP/1.1
    
    Host: 192.168.1.100
    
    User-Agent: Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_6_8; en) AppleWebKit/5
    33.16 (KHTML, like Gecko) Version/5.0 Safari/533.16
    
    Accept: */*
    
    Referer: http://192.168.1.100/
    
    X-Icm-A: icm-c
    
    Accept-Language: en-us
    
    Accept-Encoding: gzip, deflate
    
    Connection: keep-alive
    
    
    
    
    FIFO[0] 00000000
    * NO  POST *
    
    ----- Start of Request----------------------------
    FIFO[1] 00000001
    ID: 0
    Request Count     : 4556
    GET /img/focus.png
    3-14 2-14 1-14 0-17
    clsd open lstn estb clwt clng udps
    0000-0000-1110-0001-0000-0000-0000
    
    GET /img/focus.png HTTP/1.1
    
    Host: 192.168.1.100
    
    User-Agent: Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_6_8; en) AppleWebKit/5
    33.16 (KHTML, like Gecko) Version/5.0 Safari/533.16
    
    Accept: */*
    
    Referer: http://192.168.1.100/
    
    X-Icm-A: icm-c
    
    Accept-Language: en-us
    
    Accept-Encoding: gzip, deflate
    
    Connection: keep-alive
    
    
    
    
    FIFO[2] 00000201
    * NO  POST *
    
    ----- Start of Request----------------------------
    FIFO[2] 00000201
    ID: 0
    Request Count     : 4557
    3-17 2-17 1-17 0-18
    clsd open lstn estb clwt clng udps
    0000-0000-0000-1110-0000-0001-0000
    
    FIFO[1] 00000002
    * Timeout *
    
    ----- Start of Request----------------------------
    FIFO[1] 00000002
    ID: 1
    Request Count     : 4557
    GET /img/plbk.png
    3-17 2-17 1-17 0-18
    clsd open lstn estb clwt clng udps
    0000-0000-0000-1110-0000-0001-0000
    
    GET /img/plbk.png HTTP/1.1
    
    Host: 192.168.1.100
    
    User-Agent: Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_6_8; en) AppleWebKit/5
    33.16 (KHTML, like Gecko) Version/5.0 Safari/533.16
    
    Accept: */*
    
    Referer: http://192.168.1.100/
    
    X-Icm-A: icm-c
    
    Accept-Language: en-us
    
    Accept-Encoding: gzip, deflate
    
    Connection: keep-alive
    
    
    
    
    FIFO[0] 00000000
    * NO  POST *
    
    ----- Start of Request----------------------------
    FIFO[2] 00000804
    ID: 2
    Request Count     : 4558
    GET /img/subs.png
    3-17 2-17 1-18 0-18
    clsd open lstn estb clwt clng udps
    0000-0000-0000-1100-0000-0011-0000
    
    GET /img/subs.png HTTP/1.1
    
    Host: 192.168.1.100
    
    User-Agent: Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_6_8; en) AppleWebKit/5
    33.16 (KHTML, like Gecko) Version/5.0 Safari/533.16
    
    Accept: */*
    
    Referer: http://192.168.1.100/
    
    X-Icm-A: icm-c
    
    Accept-Language: en-us
    
    Accept-Encoding: gzip, deflate
    
    Connection: keep-alive
    
    
    
    
    FIFO[1] 00000008
    * NO  POST *
    
    ----- Start of Request----------------------------
    FIFO[1] 00000008
    ID: 3
    Request Count     : 4559
    GET /img/config.png
    3-17 2-18 1-14 0-14
    clsd open lstn estb clwt clng udps
    0000-0000-0011-1000-0000-0100-0000
    
    GET /img/config.png HTTP/1.1
    
    Host: 192.168.1.100
    
    User-Agent: Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_6_8; en) AppleWebKit/5
    33.16 (KHTML, like Gecko) Version/5.0 Safari/533.16
    
    Accept: */*
    
    Referer: http://192.168.1.100/
    
    X-Icm-A: icm-c
    
    Accept-Language: en-us
    
    Accept-Encoding: gzip, deflate
    
    Connection: keep-alive
    
    
    
    
    FIFO[0] 00000000
    * NO  POST *
    
    

    Very confusing... the page loads complete with css and javascript and all images, but the Ajax doesn't work at all as the connection goes dead right after the page load.

    I'm noticing the failed requests don't actually increment the request count... what does this mean?

    Thanks for your time and advice!!!
    So what would prevent the
  • rapscaLLionrapscaLLion Posts: 75
    edited 2012-04-15 17:40
    Hmmm... well I don't know why this works, but I found that changing the time out retry delay
    waitcnt((clkfreq/500) + cnt
    
    to
    waitcnt((clkfreq/350) + cnt
    
    seems to make it work. I tried with 450 and it still works, but some requests had up to four retries. Whereas with 350, there was a maximum of three retries on some requests.

    Is this the correct way to address the issue? Because the page now works, AJAX and all on my iPhone 4G. Haven't tested with 3G or iPods yet.

    Cheers
  • xanaduxanadu Posts: 3,347
    edited 2012-04-16 14:30
    This isn't much help but I used the Spinneret a lot on Safari on an iPhone 3g with no problems. It was just basic HTML any browser should be able to display it. The issue could be the iPhone3g has the slowest wireless network connection and that slow connection is introducing the problems.

    If you have a device on the network broadcasting and ARP packet, and no response that is strange. Try changing your Spinneret's MAC and rebooting everything on the network including the router, if you haven't already.
  • Mike GMike G Posts: 2,702
    edited 2012-04-16 19:38
    I really appreciate the feedback rapscaLLion.

    So having a longer retry wait fixed the iPhone issue - sweet. That's good to know.
  • ddstarkeyddstarkey Posts: 6
    edited 2012-12-06 18:48
    I think that the 350 clock cycles approaches the minimum amount you can delay in SPIN without overflowing and causing a 54-second delay.
Sign In or Register to comment.