Skip to content

An interesting bug in the example dht22-data-loger or in netcon? #51

@gerey73

Description

@gerey73

I changed the example a little:

exception: EGAVEUP
variable: data
variable: server
variable: ecnt
 : measure ( -- temperature humidity | throws:EGAVEUP )
    10 0 do
        ['] dht-measure catch ?dup if ex-type cr 5000 ms else unloop exit then
    loop
    EGAVEUP throw ;
 : data! ( temperature humidity -- ) 16 lshift swap or data ! ;
 : connect ( -- ) 8005 "192.168.1.6" TCP netcon-connect server ! ; 
 : dispose ( -- ) server @ netcon-dispose ;
 : send ( -- ) server @ data 4 netcon-write-buf ;
 : log ( temperature humidity -- ) data! connect ['] send catch dispose throw ;
 : log-measurement ( -- ) { measure log } catch ?dup if  ex-type  1 ecnt +! ecnt @ space . cr then ; 
\ : main ( -- ) log-measurement 50 ms 120000000 deep-sleep ;
: main begin log-measurement 2000 ms again ;    

As long as the "server" receiving the information is working, everything seems fine.
But if you stop the server and wait for> 70 attempts to connect to the server and start the server again, then (esp8266) can no longer connect. Up to 70 attempts a connection is restored.
Failed to connect to 192.168.1.6:8005. Error: -14 NETCON error: -14 ENETCON 67 Failed to connect to 192.168.1.6:8005. Error: -14 NETCON error: -14 ENETCON 68 Failed to connect to 192.168.1.6:8005. Error: -14 NETCON error: -14 ENETCON 69 Failed to connect to 192.168.1.6:8005. Error: -14 NETCON error: -14 ENETCON 70 Failed to connect to 192.168.1.6:8005. Error: -14 NETCON error: -14 ENETCON 71 ENETCON 72 ENETCON 73 ENETCON 74 ENETCON 75 ENETCON 76 ENETCON 77

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions