Shop OBEX P1 Docs P2 Docs Learn Events
Trouble getting W5200 connected , Solved , DHCP+Netbios+Basic Auth+Multisocketserver - Page 6 — Parallax Forums

Trouble getting W5200 connected , Solved , DHCP+Netbios+Basic Auth+Multisocketserver

123468

Comments

  • Igor_RastIgor_Rast Posts: 357
    edited 2012-10-25 09:53
    Mike G wrote: »
    sock.Listen is commented in the StartListners method. No socket listener on the line.

    PUB StartListners | i
      repeat i from 0 to SOCKETS-1
    	sock[i].Listen
    

    That,s true . Overlooked that .
    change it with yours ,But I stilll cant get the page loaded ,
    I can see in wireshark that when i open the page in the brouwser, the pc and the prop talk back and forth a bit .
    but the page never loads . so somthing still stops the page from getting out


    UPDATE

    I already found the problem , there were a few pst statements left in the parseresourse , I removed those and now it does load the page

    and it works faster too mike . page load up verry fast
  • Igor_RastIgor_Rast Posts: 357
    edited 2012-10-25 11:49
    Ok , Thout let me post the fix for other reading this having the same problem .
    i have added a hard reset just before all starts , this ensures that it always lauches right and the wiznet is not busy with something else
    PUB HardRestart_WIZ
      dira[nRESET_WIZ]~~  
      outa[nRESET_WIZ]~~
      waitcnt(clkfreq/2000 +cnt)
      outa[nRESET_WIZ]~
      waitcnt(clkfreq/2000 +cnt)
      outa[nRESET_WIZ]~~ 
      return  
    

    and with removal of all the pst statments , its all working again ,. WITHOUT( NOT CONNECTED) THE USB-PROPSTICK connected

    this how it looks like for a easy copy past
    A DHCP + multisocketserver running wich can be address by hostname , So no bothering with ip adress .
    Many thanks to mike for his great work and support .

    last ting still is get the login page running and working along with all the ajax request going on and other task the propeller is also doing ( monitoring sensor, and setpoints )
    , . hopefully the last chapter
    PUB Main | i, page, dnsServer
        
      HardRestart_WIZ 
    
      i := 0
      setpoint :=  i2cObject.ReadLong(i2cSCL, EEPROMAddr, $7981) 
      offset :=  i2cObject.ReadLong(i2cSCL, EEPROMAddr, $7977)    
    
       
      cognew(Tempcontrol,@stack1)
    
      pause(500)
    
      wiz.start(6, 5, 4, 7)
      wiz.SetMac($00, $08, $DC, $16, $F8, $01)
    
      dhcp.Init(@buff, 7)
      repeat until dhcp.DoDhcp
        if(++i > DHCP_ATTEMPTS)
          quit
    
      if(dhcp.GetErrorCode > 0  OR i > DHCP_ATTEMPTS)
        return
      else
        PrintIp(dhcp.GetIp)
    
      dnsServer := wiz.GetDns
      PrintIp(wiz.GetDns)
      printIp(wiz.GetDhcpServerIp)
      printIp(wiz.GetRouter)
    
    
      repeat       
        repeat i from 0 to SOCKETS-1
          sock[i].Init(i, TCP, 80)             
        OpenListeners
        StartListners      
        \MultiSocketServer
        pause(5000)
      
    PUB OpenListeners | i
      repeat i from 0 to SOCKETS-1  
         sock[i].Open
          
    PUB StartListners | i
      repeat i from 0 to SOCKETS-1
        sock[i].Listen
    
    PUB CloseWait | i
      repeat i from 0 to SOCKETS-1
       
        if(sock[i].IsCloseWait) 
          sock[i].Disconnect
          sock[i].Close
                
        if(sock[i].IsClosed)  
          sock[i].Open
          sock[i].Listen
    
    PUB MultiSocketServer | bytesToRead, i, page, j, x , bytesSent, ptr  
    
      bytesToRead := bytesSent := i := j := x := 0  
      repeat   
        CloseWait  
         
        repeat until sock[i].Connected
          i := ++i // SOCKETS
             
        repeat until bytesToRead := sock[i].Available   
    
        if(bytesToRead < 0)
          sock[i].Disconnect
          sock[i].Open
          sock[i].Listen
          bytesToRead~
          next
    
        sock[i].Receive(@buff, bytesToRead)
        page :=  ParseResource(@buff)      
    
        bytesSent := 0
        ptr := page
        repeat until bytesSent == strsize(page)
          bytesSent += sock[i].Send(ptr, strsize(ptr))
          ptr := page + bytesSent
    
        if(sock[i].Disconnect)
          do_nothing      
        else
        sock[i].Open
        sock[i].Listen
        sock[i].SetSocketIR($FF)
        
        i := ++i // SOCKETS
        bytesToRead~
        
    PUB HardRestart_WIZ
      dira[nRESET_WIZ]~~  
      outa[nRESET_WIZ]~~
      waitcnt(clkfreq/2000 +cnt)
      outa[nRESET_WIZ]~
      waitcnt(clkfreq/2000 +cnt)
      outa[nRESET_WIZ]~~ 
      return  
        
    PUB do_nothing   
     return
     
    PUB ParseResource(header) | ptr, value, i, done, j
      ptr := header
      i := 0
      done := false
    
      repeat until IsEndOfLine(byte[ptr])
        if(IsToken(byte[ptr]))
          byte[ptr] := 0
          resPtr[i++] := ++ptr
        else
          ++ptr
    
        if(ptr - header > 500)     
          return @index
    
      resPtr[0] := header 
    
      repeat j from 0 to i-1
        if(strcomp(resPtr[j], string("HTTP")))
          return @index
    
          
        if(strcomp(resPtr[j], string("xmltemp")))
          value := GetTemp
          Settemp(tempc3,@temperature)
          Setlv(lv3,@lvlv)
          Settemp(tempmax,@t_max)
          Settemp(tempmin,@t_min)
          Setlv(lvmax,@lv_max)
          Setlv(lvmin,@lv_min)
          Setlv(setpoint,@Set_p)
          Setlv(offset,@off_s)
          return @xml
    
        if(strcomp(resPtr[j], string("setpointplus")))
            setpointplus
            return 
        
                
    PUB setpointplus     
     if setpoint < 99
       Setpoint:= Setpoint + 1
     return
    

    Mike , got a feeling the server is working faster also , because of the pst statements beeing removed, any way of measuring that ?
  • twctwc Posts: 107
    edited 2012-10-25 15:32
    ...think the SPI driver is faster now!

    I have experienced that a demo program may have problem (ex: DHCP 'Discover Error') if the Wiz820io is not started from 'reset condition' which may be either power-on-reset, nRESET pin control and (possibly, I haven't tried it) software reset command.
  • Igor_RastIgor_Rast Posts: 357
    edited 2012-10-26 06:02
    twc wrote: »
    ...think the SPI driver is faster now!

    I have experienced that a demo program may have problem (ex: DHCP 'Discover Error') if the Wiz820io is not started from 'reset condition' which may be either power-on-reset, nRESET pin control and (possibly, I haven't tried it) software reset command.

    I had that probleem , Mike mentiond that it is some kind of conflict Hardware or Firmware. , Not sure wich one
    i bypased the hole problem by complety removing all pst statements ,
    you have the pst statements in the dhcp demo ?? try removing them an see if the problem still ther
  • Mike GMike G Posts: 2,702
    edited 2012-10-26 06:34
    Igor_Rast, thanks for the reset logic.

    I'll incorporate your reset logic as well as build a handler to detect W5200 connections for stand alone operation.
  • Igor_RastIgor_Rast Posts: 357
    edited 2012-10-26 06:55
    Mike G wrote: »
    Igor_Rast, thanks for the reset logic.

    I'll incorporate your reset logic as well as build a handler to detect W5200 connections for stand alone operation.

    Mike glad to hear that at least that I could contribute . sweet

    im not so sure about the timming , deffinitly could do it faster, its pretty slow now
    did it like that just to be sure its resetting, but the datasheet may give a better timming . only im not that good at calculating that for the prop :p
    sure it wil be a quik awnser for the one who knows

    Is the PST issue worth a own tread to get it solved mike ??
  • Igor_RastIgor_Rast Posts: 357
    edited 2012-10-26 08:51
    Mike how do you sugest the login page get incorporated in the multisocket , i have edditi the mulitsocket like below , and about 10 other combinations including the tokenzeheader
    but this is deffinitly not working,
    PUB MultiSocketServer | bytesToRead, i, page, j, x , bytesSent, ptr  
    
      bytesToRead := bytesSent := i := j := x := 0  
      repeat   
        CloseWait  
         
        repeat until sock[i].Connected
          i := ++i // SOCKETS
             
        repeat until bytesToRead := sock[i].Available   
    
        if(bytesToRead < 0)
          sock[i].Disconnect
          sock[i].Open
          sock[i].Listen
          bytesToRead~
          next
    
        sock[i].Receive(@buff, bytesToRead)
        {page :=  ParseResource(@buff)}      
        req.TokenizeHeader(@buff, bytesToRead)
    
    
        if(req.UrlContains(string("favicon.ico")))
          pst.str(string("404 Error", CR))
          sock.Send(@notFound, strsize(@notFound))
          sock.Disconnect
          bytesToRead~
          next
        
        {{ Process the Rx data}}
        'Check for Authorization header
        if(IsAuthenticated)
          pst.str(string("Authenticated", CR))
          sock.Send(@index, strsize(@index))
        else
          pst.str(string("Not Authenticated", CR))
          sock.Send(@auth, strsize(@auth))
    
    
        {bytesSent := 0}
        {ptr := page}
        {repeat until bytesSent == strsize(page)}
          {bytesSent += sock[i].Send(ptr, strsize(ptr))}
          {ptr := page + bytesSent}
    
        if(sock[i].Disconnect)
          do_nothing      
        else
        sock[i].Open
        sock[i].Listen
        sock[i].SetSocketIR($FF)
        
        i := ++i // SOCKETS
        bytesToRead~
    

    where the parsereasource returnd the page to be displayed back to the main pgram and then spit it to the buffer , the tokenheader seems to spit it out from there . confusing me even more ,.
    aint got a clue , where to put the url that the prop has to listen to (POST), for it to listen to a command when a button is pushed ( e.g. led).
  • Mike GMike G Posts: 2,702
    edited 2012-10-26 12:32
    Igor_Rast wrote:
    Mike how do you sugest the login page get incorporated in the multisocket , i have edditi the mulitsocket like below , and about 10 other combinations including the tokenzeheader
    but this is deffinitly not working,

    I committed Html5GraphBasicAuthentication.spin to the code repository. It shows how to copy and paste the basic authentication demo source to Html5Graph.
    Igor_Rast wrote:
    where the parsereasource returnd the page to be displayed back to the main pgram and then spit it to the buffer , the tokenheader seems to spit it out from there . confusing me even more ,.
    As stated in previous post, you should not mix the parsereasource from Html5Graph and tokenheader from the HttpHeader object. You're essentially tokenizing the header twice. Use the httpHeader object ONLY!

    Igor_Rast wrote:
    aint got a clue , where to put the url that the prop has to listen to (POST), for it to listen to a command when a button is pushed ( e.g. led).
    This is not a logon page! The demo uses basic authentication. A logon page would take a lot more work and require supporting objects. At this point, I only have an idea of how to accomplish the task. I do know the task would require session state and encrypted tokens as well as research and development.
  • Igor_RastIgor_Rast Posts: 357
    edited 2012-10-26 15:15
    He mike , Thanks for the adding , There was a pst statment left in the multisocket server , you sould remove it
    . after that , it now works great. Thnaks allot

    one other thing ,
    I was trying again with some smartphones(blackberry & nokia n97 symbian) to get the page loaded , but the connections seems to time out ,
    in allot of tries the page may partialy load up one time than alot of times not again , so I suspect its the famous timeout issue .

    read a few post , but I cant seem to find the timeout statment anywhere in the html5graph files.
    could you point me the ? :P thanks
  • Igor_RastIgor_Rast Posts: 357
    edited 2012-10-26 15:36
    Mike.
    When I open the login page, and its asking me for the username and password.
    If i enter it right away , thothing wrong, and the server works fine

    But if i wait for let say a minute before I login with the page open for that minute.
    I think the connection is getting time out orso ,and then getting stuck .the propeller nevver recovers. to ask for the password again , or serve the page
    I am then unable to connect to it anymore , also not with a new brouwser window .
  • Mike GMike G Posts: 2,702
    edited 2012-10-26 15:36
    read a few post , but I cant seem to find the timeout statment anywhere in the html5graph files.

    Default timeout setting are in the Socket.spin object.
      'Increase TRANS_TIMEOUT in increments of 100*X if you are experiencing timeouts
      TRANS_TIMEOUT     = 1000   
      TIMEOUT           = TRANS_TIMEOUT * 10
    

    Html5Graph (Top level object) sets the Socket object properties using setter methods.
    PUB SetTimeout(value)
      _timeout := value
    
    PUB SetTransactionTimeout(value)
      _trans_timeout := value
    

    What troubleshooting steps have you taken?
  • Mike GMike G Posts: 2,702
    edited 2012-10-26 15:54
    But if i wait for let say a minute before I login with the page open for that minute.
    I think the connection is getting time out orso ,and then getting stuck .the propeller nevver recovers. to ask for the password again , or serve the page
    I am then unable to connect to it anymore , also not with a new brouwser window .
    I left the password prompt open for 5 minutes then clicked OK. The graph page loaded as expected.

    You must close then open the browser to invoke a new password prompt.
  • Igor_RastIgor_Rast Posts: 357
    edited 2012-10-26 16:29
    ill troubleshoot with the iphone tommorow as the person hoe had it left me, comming back tomorrow .
    Thout I start to find te timeout as i knew i read about that a couple of times .
    But the html5graphl page doesn,t load so ill have to do the timming troubleshoot first thing in the morging. thanks for telling me where.

    around wich value would you say is a good starting value and increase decreas in steps of howmuch ..
    sadly i dont have the phone now , ill try tommorrow and let you know

    o bye the way..Jazzed mention he knew about the problem we are having with the pst and a solution for it ,
    chek it out
  • twctwc Posts: 107
    edited 2012-10-27 05:32
    Hey Mike - not sure you should add nRESET to your code unless there's a way to make it optional. Some apps may just use POR and/or drive nRESET from global reset signal. It's easy enough for end-user app to handle nRESET (and PWDN & nINT) if they choose to and are able/willing to devote the Prop pins.
  • Mike GMike G Posts: 2,702
    edited 2012-10-27 07:45
    Removed nReset IO Pin from the start parameters and added the Pin IO to the HardReset(pin) method.
  • Igor_RastIgor_Rast Posts: 357
    edited 2012-10-27 11:02
    Good point twc, I see mike already did it . nice going

    Mike , about the server hanging .

    I troubleshooted alot but cant find anything strange

    If I load your demo code , and I added just the HTML page of my , so its some bigger . anyway
    it works fine in the biginning

    but if i repeatedly .
    open a new browser ---- go to the login page
    login ---- run page a few seconds -- do e few refresh (F5) -- close the bouwser again .
    and start all over , to log in again ,.

    if I keep doing this , eventualy the server hangs . not letting anything load or open anymore .
    But i can ping it with the pc , but not get a page reply .

    sometimes it take 5 retryies to get it to hang, the otrher time 30 times , so its a little bit random .
    Sure your not having this problem mike ??
  • Mike GMike G Posts: 2,702
    edited 2012-10-27 12:00
    I'm not exactly sure what demo you are running but it sounds like pressing F5 or ctrl F5 several times causes unexpected results. Probably displays a message like "Unable to Connect"?

    That sounds like the socket is not in the expected state. The socket could be in the CloseWait or Closing state. I slightly modified TcpSocketBasicAuthenticationServerDemo.spin and committed the changes. Load the code and see if that helps with the locks.


    If the page does not display, try pressing refresh. The server should recover.
  • Igor_RastIgor_Rast Posts: 357
    edited 2012-10-27 12:55
    Mike it looks like its working without getting stuck .

    There is a sencario.
    When I run the serveer . Open the loginpage on one computer on my network , and leave the login page open not loggin in yet , and open another brouweser on another computer on my network , and try to connect with the second pc.
    then again the server gets hanging ,

    the initial hanging doesnt seem to happen anymore

    PST
    [HTML]
    Request:
    GET /xmltemp?ms=1351368588056 HTTP/1.1
    Host: px-100:8080
    User-Agent: Mozilla/5.0 (Windows NT 5.1; rv:16.0) Gecko/20100101 Firefox/16
    .0
    Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
    Accept-Language: nl,en-us;q=0.7,en;q=0.3
    Accept-Encoding: gzip, deflate
    Connection: keep-alive
    Referer: http://px-100:8080/
    Authorization: Basic d2ViOndlYg==

    Send Response
    Byte to send 252
    Bytes Sent 252
    Disconnect socket 0
    Disconnected
    TCP Service
    Connected Socket 0
    Copy Rx Data

    Request:
    GET /xmltemp?ms=1351368589057 HTTP/1.1
    Host: px-100:8080
    User-Agent: Mozilla/5.0 (Windows NT 5.1; rv:16.0) Gecko/20100101 Firefox/16
    .0
    Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
    Accept-Language: nl,en-us;q=0.7,en;q=0.3
    Accept-Encoding: gzip, deflate
    Connection: keep-alive
    Referer: http://px-100:8080/
    Authorization: Basic d2ViOndlYg==

    Send Response
    Byte to send 252
    Bytes Sent 252
    Disconnect socket 0
    Disconnected
    TCP Service
    Connected Socket 0
    Copy Rx Data

    Request:
    GET / HTTP/1.1
    Host: px-100:8080
    Connection: keep-alive
    User-Agent: Mozilla/5.0 (X11; Linux i686) AppleWebKit/537.4 (KHTML, like Ge
    cko) Chrome/22.0.1229.94 Safari/537.4
    Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
    Accept-Encoding: gzip,deflate,sdch
    Accept-Language: en-US,en;q=0.8
    Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.3

    Not Authenticated
    Send Response
    Byte to send 148
    Bytes Sent 148
    Disconnect socket 0
    Force Close
    TCP Service
    Connected Socket 1
    Copy Rx Data

    Request:
    GET / HTTP/1.1
    Host: px-100:8080
    Connection: keep-alive
    Authorization: Basic d2ViOndlYg==
    User-Agent: Mozilla/5.0 (X11; Linux i686) AppleWebKit/537.4 (KHTML, like Ge
    cko) Chrome/22.0.1229.94 Safari/537.4
    Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
    Accept-Encoding: gzip,deflate,sdch
    Accept-Language: en-US,en;q=0.8
    Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.3

    Send Response
    Byte to send 8171
    Bytes Sent 8171
    Disconnect socket 1
    Disconnected
    TCP Service
    Connected Socket 2
    Copy Rx Data

    Request:
    GET /favicon.ico HTTP/1.1
    Host: px-100:8080
    Connection: keep-alive
    Authorization: Basic d2ViOndlYg==
    Accept: */*
    User-Agent: Mozilla/5.0 (X11; Linux i686) AppleWebKit/537.4 (KHTML, like Ge
    cko) Chrome/22.0.1229.94 Safari/537.4
    Accept-Encoding: gzip,deflate,sdch
    Accept-Language: en-US,en;q=0.8
    Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.3

    Send Response
    Byte to send 8171
    Bytes Sent 8171
    Disconnect socket 2
    Disconnected
    TCP Service
    Connected Socket 3

    [/HTML]
  • Mike GMike G Posts: 2,702
    edited 2012-10-27 13:14
    If you are running the demo in post 168, you only have one socket running. That means one available connection. The initial logon is holding the socket open waiting for a username and password. If you require more concurrent connections then start more sockets. You have 8 max plus you have modify the code so it cycles through the available sockets.

    Edit: The browser will handle the authentication request. Several browser instances can be opened with the Authentication Request alert dialog open. Clicking OK will send a second request with the base64 encoded username and password.
  • Igor_RastIgor_Rast Posts: 357
    edited 2012-10-27 13:43
    Mike G wrote: »
    If you are running the demo in post 168, you only have one socket running. That means one available connection. The initial logon is holding the socket open waiting for a username and password. If you require more concurrent connections then start more sockets. You have 8 max plus you have modify the code so it cycles through the avaialable sockets.

    Im running the Html5GraphBasicAuthentication spin code, it was multisocket right ?? in the beginning it states 7 sockets,
    aint that suppose to make the multiple connections possible

    but running the code with 1 socket if thats the case, it sould be possible to not let the prop hang when a seccond connection is trieing to connect at the same time. just drop it orso . now it hangs
  • Mike GMike G Posts: 2,702
    edited 2012-10-27 14:54
    I have not written code to handle concurrent requests for the W5200. If you require concurrency, then you'll have to write the code. The Spinneret source can handle concurrency by monitoring and queuing socket status. There is also buffer considerations.

    Anyway, see the Spinneret code for ideas.
  • Igor_RastIgor_Rast Posts: 357
    edited 2012-10-27 16:49
    Mike G wrote: »
    I have not written code to handle concurrent requests for the W5200. If you require concurrency, then you'll have to write the code. The Spinneret source can handle concurrency by monitoring and queuing socket status. There is also buffer considerations.

    Anyway, see the Spinneret code for ideas.

    Mike , I have figured out what was going on the the prop was hanging .
    Fist the steps to get it hanging and not responding anymore

    computer1 - I open a brouwser , open the page , login . and the page runs fine .
    after this , I open a second brouwser tab within the same brouwser . and close the first one . this way I have closed the page from the prop , but the brouwser is stil kept its autorization to acces the page

    on computer 2 , Or this could be another brouwser ( eg. Crome & firefox )
    open brouwser and go to the page , but dont log in yet.
    when the page is open and asking for the login ,. leave it

    Go back to pc 1 and open the page of the prop with the brouwser that already has the autorization .
    This is where the prop hangs in the connected state , never recovvering .
    in the pst i see this every time it hangs .
    [HTML]Send Response
    Byte to send 252
    Bytes Sent 252
    Disconnect socket 4
    Disconnected
    TCP Service
    Connected Socket 5[/HTML]
    so there is a soccet that get conencted never timing out
    .

    Having a look at the multisocket closer .
        repeat until sock[i].Connected
          i := ++i // SOCKETS
    
        pst.str(string("Connected Socket "))
        pst.dec(i)
        pst.char(CR)
        
        'Data in the buffer?
        repeat until NULL < bytesToRead := sock[i].Available
    
        
       'Check for a timeout
        if(bytesToRead < 0)
          pst.str(string("Timeout",CR))
          sock[i].Disconnect
          sock[i].Open
          sock[i].Listen
          bytesToRead~
          next
    

    the if thatment for the timeout , was never part of the first reapeat untill
    so I moved them 2 spaces back , so they wil be part of the repeat untill
        'Data in the buffer?
        repeat until NULL < bytesToRead := sock[i].Available
          if(bytesToRead < 0)
            pst.str(string("Timeout",CR))
            sock[i].Disconnect
            sock[i].Open
            sock[i].Listen
            bytesToRead~
            next
    

    And now magicly , In the same situation as before .
    When it hangs . with a few refreshes and a few timouts poping up in the pst . all resumes to normal operation

    [HTML]
    Send Response
    Byte to send 252
    Bytes Sent 252
    Disconnect socket 0
    Disconnected
    TCP Service
    Connected Socket 0
    Timeout
    Timeout
    Timeout
    Timeout
    Timeout
    Timeout
    Copy Rx Data

    Request:
    GET / HTTP/1.1
    Host: px-100:8080
    User-Agent: Mozilla/5.0 (Windows NT 5.1; rv:16.0) Gecko/20100101 Firefox/16
    .0
    Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
    Accept-Language: nl,en-us;q=0.7,en;q=0.3
    Accept-Encoding: gzip, deflate
    Connection: keep-alive

    Not Authenticated
    Send Response
    Byte to send 148
    Bytes Sent 148
    Disconnect socket 0
    Disconnected
    TCP Service
    Connected Socket 0
    Copy Rx Data
    [/HTML]

    was this moved by accident ,or am I seeing it wrong . works fine now

    one thing thou
    when you do nothing , the timout statments , keeps repeating ,.
    sould I add a force socket close. or is this gonna close the socket like its not the intention


    im getting an force close statement when i try to connect with a nokia n97 symbian phone
    what does this mean . ive play whti the transtimeout alot whitout resutls

    [HTML]Send Response
    Byte to send 8171
    Bytes Sent 8171
    Disconnect socket 0
    Force Close
    TCP Service[/HTML]
  • Mike GMike G Posts: 2,702
    edited 2012-10-27 17:47
    Igor, your expectations are beyond the capabilities of the current W5200 code base.
  • Igor_RastIgor_Rast Posts: 357
    edited 2012-10-27 17:53
    Mike G wrote: »
    Igor, your expectations are beyond the capabilities of the current W5200 code base.
    dont realy understand what you mean , Its working just like i wanted now , on the pc, no hanging , no fuss. the smartphoneś only it doens open .
    do you refer to wanting it to work on all those smartphones and a normal pc is too mucha of an expectation for te wiz
  • Mike GMike G Posts: 2,702
    edited 2012-10-28 07:49
    dont realy understand what you mean , Its working just like i wanted now , on the pc, no hanging , no fuss. the smartphoneś only it doens open .
    do you refer to wanting it to work on all those smartphones and a normal pc is too mucha of an expectation for te wiz
    In post 169 and 173 you are testing concurrency. Be advised, there is NO CODE written that handles true concurrency!

    Secondly, moving the if statement inside repeat until NULL < bytesToRead := sock.Available is not a good idea. A better solution is removing the NULL conditional statement.

    repeat until bytesToRead := sock[i].Available
    

    Html5GraphBasicAuthentication.spin is committed to the code repository with slight modifications to better deal with multiple authentication requests. However, MultiSocketServer does not handle true concurrency it just appears like it does. The Basic Authentication demo works because of the way the browser functions. The Authentication request/response is two separate requests. I just figured out that when the Authentication alert is open the original socket severed up to page is is closed. The browser is not connected to a socket as I originally thought.
  • Igor_RastIgor_Rast Posts: 357
    edited 2012-10-28 08:42
    now I understand the concurrency issue , but it wansnt the idear to let them work in lets say tru parallel , like the propeller cogs do .
    correct me if im wrong ,
    but now the server handels , the request 1 after another in a quee list fasion , but its working pretty fast ,
    I think I would not need true concurrency. for this application of just mesuring a temp sensor. and serving a page and managing a small interface(LCD+LED+buttons) on the propside

    about the timeout , your suggestion works fine now , I dont get the timeouts anymore to see in the pst .. nice


    but where are the timeouts that I used before intended for then , are those causing the socket to close prior to me opening it on my nokia n97 smartphone
    UPDATE : strangly the html5graph demo does open on the phone , but my bigger code page doesn,t are all the sylesheets enso atache to it making the socket close ?
    seems like the nokia is not supporting html5 but only 4.1 . so the graph is not going to display. ill have to live with that :p


    edit ; i just missed your postupdate .

    another thing the mod did seem to solve is .

    before , when the page and the pst are open , you can see allot of activity . happening at the pst side .

    if you leave the brouwser tab open and just go to another tab , the speed of the activity seem to get reduced by half

    but now it doesnt anymore, now its constant the hole time nice
  • Mike GMike G Posts: 2,702
    edited 2012-10-28 09:08
    but where are the timeouts that I used before intended for then , are those causing the socket to close prior to me opening it on my nokia n97 smartphone
    Placing the if statement inside the repeat loop causes a bug on timeouts.

    This following statement ignores timeouts.
    repeat until NULL < bytesToRead := sock.Available
    

    This statement passes a timeout and let's you do something about it.
        repeat until bytesToRead := sock.Available
    
        'Check for a timeout
        if(bytesToRead < 0)
          bytesToRead~
          pst.str(string("Timeout",CR))
          next
    
    UPDATE : strangly the html5graph demo does open on the phone , but my bigger code page doesn,t are all the sylesheets enso atache to it making the socket close ?
    I thought your stylesheets were located on another computer not the W5200/Porp?
  • Igor_RastIgor_Rast Posts: 357
    edited 2012-10-28 09:51
    Mike G wrote: »


    I thought your stylesheets were located on another computer not the W5200/Porp?
    yes they are on another computer beeing served . but I mean including them , the html5graph . has just one script and no stylesheets.

    my page im working on has a few stylesheets and 2 javascripts. that I meant with bigger

    thanks for the timeout explination
  • Igor_RastIgor_Rast Posts: 357
    edited 2012-10-31 06:04
    Mike ,Or anybodyelse reading this post

    Did you have the sensiron SHT-11 temperture & humidity sensor ??

    if so ,
    I was having some problems with the temperture , jumping up 1 degree and going back , resulting in spikes in the html5graph that is beeing served to a webpage by the wiznet server.
    the temp also jump on the lcd display controlled by the propeller .normaly it just jumps 0.1 degree orso and back

    I thout that it has to be with , a cog reading the values wile another cog is writing to the same values ,
    integrated some lockes to make sure they get exclusive acces to the variables.but it still getting spikes .

    anybody got an idea about whats going on ?
    in other words , impove the stability of the reading
  • Mike GMike G Posts: 2,702
    edited 2012-10-31 06:59
    You really should start a new post for this issue. Maybe in the Sensor or Propeller forum.

    According to the data sheet at 22 C the SHT-11 has an accuracy of is +/-0.5 C. At ~10 C accuracy is closer to +/-1 C

    Assuming the source code is bug free, consider averaging 3 samples before sending the values to the graph.

    Add an array of temperature values. Fill each element in a circular fashion. When it comes time to populate the graph, send the average of the three temperatures.

    When populating the array, validate the temperature value is within an acceptable deviation form the mean. If it is not acceptable do not add the temperature value.
Sign In or Register to comment.