shamblett / coap

A Coap package for dart
Other
16 stars 13 forks source link

How to receive data continuously? #23

Closed TerryLiu closed 3 years ago

TerryLiu commented 3 years ago

Hi, @shamblett I was caught in a new difficulty that How to receive data continuously . The Flutter app's Loading State is always in a waiting state when a coap server send msg in it.

The Flutter App's code is example\flutter\lib\main.dart:

 setState(() => _isLoading = true);
   final CoapResponse response = await client.get();

   setState(() {
     _isLoading = false;
     _data = response?.payloadString ?? 'No Data';
   });

**1. Is there a way to continuously receive the data?

  1. Why always show WARNING: >> Matcher - Ignoring unmatchable piggy-backed response?**

Please help me.

The log see:

I/flutter ( 4189): 2021-02-04 22:00:09.261: INFO: >> CoapUtils:lookupHost host '192.168.0.100' is an IP address, not resolving I/flutter ( 4189): 2021-02-04 22:00:09.273: INFO: >> Reliability - Scheduling transmission for I/flutter ( 4189): <<< Request Message >>> I/flutter ( 4189): Type: 0, Code: GET, Id: 4968, Token: 00006b23, I/flutter ( 4189): Options = I/flutter ( 4189): [ I/flutter ( 4189): If-Match : I/flutter ( 4189): Uri Host : Uri-Host: 192.168.0.100 I/flutter ( 4189): E-tags : I/flutter ( 4189): None I/flutter ( 4189): Uri Port : 5683 I/flutter ( 4189): Location Paths: I/flutter ( 4189): Uri Paths : hello I/flutter ( 4189): Content-Type : None I/flutter ( 4189): Max Age : None I/flutter ( 4189): Uri Queries : I/flutter ( 4189): Accept : None I/flutter ( 4189): Location Queries : I/flutter ( 4189): Proxy Uri : None I/flutter ( 4189): Proxy Scheme : None I/flutter ( 4189): Block 1 : None I/flutter ( 4189): Block 2 : None I/flutter ( 4189): Observe : 1 I/flutter ( 4189): Size 1 : 0 I/flutter ( 4189): Size 2 : 0 I/flutter ( 4189): ], I/flutter ( 4189): Payload : I/flutter ( 4189): null I/flutter ( 4189): 2021-02-04 22:00:09.274: INFO: >> Reliability - sending request, failed transmission count: 0 I/flutter ( 4189): 2021-02-04 22:00:09.275: INFO: >> Reliability - Retransmission timeout is 3921 ms I/flutter ( 4189): 2021-02-04 22:00:09.277: INFO: >> Matcher - Stored open request by KeyID[4968]) + KeyToken[00006b23] I/flutter ( 4189): 2021-02-04 22:00:09.283: INFO: >> CoapNetworkUDP - binding to 0.0.0.0 D/libc-netbsd( 4189): [getaddrinfo]: hostname=0.0.0.0; servname=(null); netid=0; mark=0 D/libc-netbsd( 4189): [getaddrinfo]: ai_addrlen=0; ai_canonname=(null); ai_flags=1024; ai_family=0 I/flutter ( 4189): 2021-02-04 22:00:13.203: WARNING: >> Reliability - Retransmission timeout elapsed I/flutter ( 4189): 2021-02-04 22:00:13.205: WARNING: >> Reliability - Timeout: retransmit message, failed count: 1 message: 4968 I/flutter ( 4189): 2021-02-04 22:00:13.208: INFO: >> Reliability - Scheduling transmission for I/flutter ( 4189): <<< Request Message >>> I/flutter ( 4189): Type: 0, Code: GET, Id: 4968, Token: 00006b23, I/flutter ( 4189): Options = I/flutter ( 4189): [ I/flutter ( 4189): If-Match : I/flutter ( 4189): Uri Host : Uri-Host: 192.168.0.100 I/flutter ( 4189): E-tags : I/flutter ( 4189): None I/flutter ( 4189): Uri Port : 5683 I/flutter ( 4189): Location Paths: I/flutter ( 4189): Uri Paths : hello I/flutter ( 4189): Content-Type : None I/flutter ( 4189): Max Age : None I/flutter ( 4189): Uri Queries : I/flutter ( 4189): Accept : None I/flutter ( 4189): Location Queries : I/flutter ( 4189): Proxy Uri : None I/flutter ( 4189): Proxy Scheme : None I/flutter ( 4189): Block 1 : None I/flutter ( 4189): Block 2 : None I/flutter ( 4189): Observe : 1 I/flutter ( 4189): Size 1 : 0 I/flutter ( 4189): Size 2 : 0 I/flutter ( 4189): ], I/flutter ( 4189): Payload : I/flutter ( 4189): null I/flutter ( 4189): 2021-02-04 22:00:13.209: INFO: >> Reliability - sending request, failed transmission count: 1 I/flutter ( 4189): 2021-02-04 22:00:13.210: INFO: >> Reliability - Retransmission timeout is 7842 ms I/flutter ( 4189): 2021-02-04 22:00:13.211: INFO: >> Matcher - Stored open request by KeyID[4968]) + KeyToken[00006b23] I/flutter ( 4189): 2021-02-04 22:00:13.294: INFO: >> Matcher - received response I/flutter ( 4189): <<< Response Message >>> I/flutter ( 4189): Type: 2, Code: 2.05 Content, Id: 4968, Token: 00, I/flutter ( 4189): Options = I/flutter ( 4189): [ I/flutter ( 4189): If-Match : I/flutter ( 4189): Uri Host : None I/flutter ( 4189): E-tags : I/flutter ( 4189): None I/flutter ( 4189): Uri Port : None I/flutter ( 4189): Location Paths: Location-Path: hello I/flutter ( 4189): Uri Paths : I/flutter ( 4189): Content-Type : 0 I/flutter ( 4189): Max Age : None I/flutter ( 4189): Uri Queries : I/flutter ( 4189): Accept : -1 I/flutter ( 4189): Location Queries : I/flutter ( 4189): Proxy Uri : None I/flutter ( 4189): Proxy Scheme : None I/flutter ( 4189): Block 1 : None I/flutter ( 4189): Block 2 : None I/flutter ( 4189): Observe : -1 I/flutter ( 4189): Size 1 : 0 I/flutter ( 4189): Size 2 : 0 I/flutter ( 4189): ], I/flutter ( 4189): Payload : I/flutter ( 4189): Been running for 0s I/flutter ( 4189): 2021-02-04 22:00:13.296: WARNING: >> Matcher - Ignoring unmatchable piggy-backed response from 192.168.0.100 : I/flutter ( 4189): <<< Response Message >>> I/flutter ( 4189): Type: 2, Code: 2.05 Content, Id: 4968, Token: 00, I/flutter ( 4189): Options = I/flutter ( 4189): [ I/flutter ( 4189): If-Match : I/flutter ( 4189): Uri Host : None I/flutter ( 4189): E-tags : I/flutter ( 4189): None I/flutter ( 4189): Uri Port : None I/flutter ( 4189): Location Paths: Location-Path: hello I/flutter ( 4189): Uri Paths : I/flutter ( 4189): Content-Type : 0 I/flutter ( 4189): Max Age : None I/flutter ( 4189): Uri Queries : I/flutter ( 4189): Accept : -1 I/flutter ( 4189): Location Queries : I/flutter ( 4189): Proxy Uri : None I/flutter ( 4189): Proxy Scheme : None I/flutter ( 4189): Block 1 : None I/flutter ( 4189): Block 2 : None I/flutter ( 4189): Observe : -1 I/flutter ( 4189): Size 1 : 0 I/flutter ( 4189): Size 2 : 0 I/flutter ( 4189): ], I/flutter ( 4189): Payload : I/flutter ( 4189): Been running for 0s I/flutter ( 4189): 2021-02-04 22:00:14.358: INFO: >> Matcher - received response I/flutter ( 4189): <<< Response Message >>> I/flutter ( 4189): Type: 2, Code: 2.05 Content, Id: 4968, Token: 00, I/flutter ( 4189): Options = I/flutter ( 4189): [ I/flutter ( 4189): If-Match : I/flutter ( 4189): Uri Host : None I/flutter ( 4189): E-tags : I/flutter ( 4189): None I/flutter ( 4189): Uri Port : None I/flutter ( 4189): Location Paths: Location-Path: hello I/flutter ( 4189): Uri Paths : I/flutter ( 4189): Content-Type : 0 I/flutter ( 4189): Max Age : None I/flutter ( 4189): Uri Queries : I/flutter ( 4189): Accept : -1 I/flutter ( 4189): Location Queries : I/flutter ( 4189): Proxy Uri : None I/flutter ( 4189): Proxy Scheme : None I/flutter ( 4189): Block 1 : None I/flutter ( 4189): Block 2 : None I/flutter ( 4189): Observe : -1 I/flutter ( 4189): Size 1 : 0 I/flutter ( 4189): Size 2 : 0 I/flutter ( 4189): ], I/flutter ( 4189): Payload : I/flutter ( 4189): Been running for 1.0010573s I/flutter ( 4189): 2021-02-04 22:00:14.360: WARNING: >> Matcher - Ignoring unmatchable piggy-backed response from 192.168.0.100 : I/flutter ( 4189): <<< Response Message >>> I/flutter ( 4189): Type: 2, Code: 2.05 Content, Id: 4968, Token: 00, I/flutter ( 4189): Options = I/flutter ( 4189): [ I/flutter ( 4189): If-Match : I/flutter ( 4189): Uri Host : None I/flutter ( 4189): E-tags : I/flutter ( 4189): None I/flutter ( 4189): Uri Port : None I/flutter ( 4189): Location Paths: Location-Path: hello I/flutter ( 4189): Uri Paths : I/flutter ( 4189): Content-Type : 0 I/flutter ( 4189): Max Age : None I/flutter ( 4189): Uri Queries : I/flutter ( 4189): Accept : -1 I/flutter ( 4189): Location Queries : I/flutter ( 4189): Proxy Uri : None I/flutter ( 4189): Proxy Scheme : None I/flutter ( 4189): Block 1 : None I/flutter ( 4189): Block 2 : None I/flutter ( 4189): Observe : -1 I/flutter ( 4189): Size 1 : 0 I/flutter ( 4189): Size 2 : 0 I/flutter ( 4189): ], I/flutter ( 4189): Payload : I/flutter ( 4189): Been running for 1.0010573s I/flutter ( 4189): 2021-02-04 22:00:15.377: INFO: >> Matcher - received response I/flutter ( 4189): <<< Response Message >>> I/flutter ( 4189): Type: 2, Code: 2.05 Content, Id: 4968, Token: 00, I/flutter ( 4189): Options = I/flutter ( 4189): [ I/flutter ( 4189): If-Match : I/flutter ( 4189): Uri Host : None I/flutter ( 4189): E-tags : I/flutter ( 4189): None I/flutter ( 4189): Uri Port : None I/flutter ( 4189): Location Paths: Location-Path: hello I/flutter ( 4189): Uri Paths : I/flutter ( 4189): Content-Type : 0 I/flutter ( 4189): Max Age : None I/flutter ( 4189): Uri Queries : I/flutter ( 4189): Accept : -1 I/flutter ( 4189): Location Queries : I/flutter ( 4189): Proxy Uri : None I/flutter ( 4189): Proxy Scheme : None I/flutter ( 4189): Block 1 : None I/flutter ( 4189): Block 2 : None I/flutter ( 4189): Observe : -1 I/flutter ( 4189): Size 1 : 0 I/flutter ( 4189): Size 2 : 0 I/flutter ( 4189): ], I/flutter ( 4189): Payload : I/flutter ( 4189): Been running for 2.0011145s I/flutter ( 4189): 2021-02-04 22:00:15.378: WARNING: >> Matcher - Ignoring unmatchable piggy-backed response from 192.168.0.100 : I/flutter ( 4189): <<< Response Message >>> I/flutter ( 4189): Type: 2, Code: 2.05 Content, Id: 4968, Token: 00, I/flutter ( 4189): Options = I/flutter ( 4189): [ I/flutter ( 4189): If-Match : I/flutter ( 4189): Uri Host : None I/flutter ( 4189): E-tags : I/flutter ( 4189): None I/flutter ( 4189): Uri Port : None I/flutter ( 4189): Location Paths: Location-Path: hello I/flutter ( 4189): Uri Paths : I/flutter ( 4189): Content-Type : 0 I/flutter ( 4189): Max Age : None I/flutter ( 4189): Uri Queries : I/flutter ( 4189): Accept : -1 I/flutter ( 4189): Location Queries : I/flutter ( 4189): Proxy Uri : None I/flutter ( 4189): Proxy Scheme : None I/flutter ( 4189): Block 1 : None I/flutter ( 4189): Block 2 : None I/flutter ( 4189): Observe : -1 I/flutter ( 4189): Size 1 : 0 I/flutter ( 4189): Size 2 : 0 I/flutter ( 4189): ], I/flutter ( 4189): Payload : I/flutter ( 4189): Been running for 2.0011145s I/flutter ( 4189): 2021-02-04 22:00:15.500: INFO: >> Start Mark-And-Sweep with 0 entries I/flutter ( 4189): 2021-02-04 22:00:16.297: INFO: >> Matcher - received response I/flutter ( 4189): <<< Response Message >>> I/flutter ( 4189): Type: 2, Code: 2.05 Content, Id: 4968, Token: 00, I/flutter ( 4189): Options = I/flutter ( 4189): [ I/flutter ( 4189): If-Match : I/flutter ( 4189): Uri Host : None I/flutter ( 4189): E-tags : I/flutter ( 4189): None I/flutter ( 4189): Uri Port : None I/flutter ( 4189): Location Paths: Location-Path: hello I/flutter ( 4189): Uri Paths : I/flutter ( 4189): Content-Type : 0 I/flutter ( 4189): Max Age : None I/flutter ( 4189): Uri Queries : I/flutter ( 4189): Accept : -1 I/flutter ( 4189): Location Queries : I/flutter ( 4189): Proxy Uri : None I/flutter ( 4189): Proxy Scheme : None I/flutter ( 4189): Block 1 : None I/flutter ( 4189): Block 2 : None I/flutter ( 4189): Observe : -1 I/flutter ( 4189): Size 1 : 0 I/flutter ( 4189): Size 2 : 0 I/flutter ( 4189): ], I/flutter ( 4189): Payload : I/flutter ( 4189): Been running for 3.0011717s I/flutter ( 4189): 2021-02-04 22:00:16.299: WARNING: >> Matcher - Ignoring unmatchable piggy-backed response from 192.168.0.100 : I/flutter ( 4189): <<< Response Message >>> I/flutter ( 4189): Type: 2, Code: 2.05 Content, Id: 4968, Token: 00, I/flutter ( 4189): Options = I/flutter ( 4189): [ I/flutter ( 4189): If-Match : I/flutter ( 4189): Uri Host : None I/flutter ( 4189): E-tags : I/flutter ( 4189): None I/flutter ( 4189): Uri Port : None I/flutter ( 4189): Location Paths: Location-Path: hello I/flutter ( 4189): Uri Paths : I/flutter ( 4189): Content-Type : 0 I/flutter ( 4189): Max Age : None I/flutter ( 4189): Uri Queries : I/flutter ( 4189): Accept : -1 I/flutter ( 4189): Location Queries : I/flutter ( 4189): Proxy Uri : None I/flutter ( 4189): Proxy Scheme : None I/flutter ( 4189): Block 1 : None I/flutter ( 4189): Block 2 : None I/flutter ( 4189): Observe : -1 I/flutter ( 4189): Size 1 : 0 I/flutter ( 4189): Size 2 : 0 I/flutter ( 4189): ], I/flutter ( 4189): Payload : I/flutter ( 4189): Been running for 3.0011717s I/flutter ( 4189): 2021-02-04 22:00:17.320: INFO: >> Matcher - received response I/flutter ( 4189): <<< Response Message >>> I/flutter ( 4189): Type: 2, Code: 2.05 Content, Id: 4968, Token: 00, I/flutter ( 4189): Options = I/flutter ( 4189): [ I/flutter ( 4189): If-Match : I/flutter ( 4189): Uri Host : None I/flutter ( 4189): E-tags : I/flutter ( 4189): None I/flutter ( 4189): Uri Port : None I/flutter ( 4189): Location Paths: Location-Path: hello I/flutter ( 4189): Uri Paths : I/flutter ( 4189): Content-Type : 0 I/flutter ( 4189): Max Age : None I/flutter ( 4189): Uri Queries : I/flutter ( 4189): Accept : -1 I/flutter ( 4189): Location Queries : I/flutter ( 4189): Proxy Uri : None I/flutter ( 4189): Proxy Scheme : None I/flutter ( 4189): Block 1 : None I/flutter ( 4189): Block 2 : None I/flutter ( 4189): Observe : -1 I/flutter ( 4189): Size 1 : 0 I/flutter ( 4189): Size 2 : 0 I/flutter ( 4189): ], I/flutter ( 4189): Payload : I/flutter ( 4189): Been running for 4.0012289s I/flutter ( 4189): 2021-02-04 22:00:17.321: WARNING: >> Matcher - Ignoring unmatchable piggy-backed response from 192.168.0.100 : I/flutter ( 4189): <<< Response Message >>> I/flutter ( 4189): Type: 2, Code: 2.05 Content, Id: 4968, Token: 00, I/flutter ( 4189): Options = I/flutter ( 4189): [ I/flutter ( 4189): If-Match : I/flutter ( 4189): Uri Host : None I/flutter ( 4189): E-tags : I/flutter ( 4189): None I/flutter ( 4189): Uri Port : None I/flutter ( 4189): Location Paths: Location-Path: hello I/flutter ( 4189): Uri Paths : I/flutter ( 4189): Content-Type : 0 I/flutter ( 4189): Max Age : None I/flutter ( 4189): Uri Queries : I/flutter ( 4189): Accept : -1 I/flutter ( 4189): Location Queries : I/flutter ( 4189): Proxy Uri : None I/flutter ( 4189): Proxy Scheme : None I/flutter ( 4189): Block 1 : None I/flutter ( 4189): Block 2 : None I/flutter ( 4189): Observe : -1 I/flutter ( 4189): Size 1 : 0 I/flutter ( 4189): Size 2 : 0 I/flutter ( 4189): ], I/flutter ( 4189): Payload : I/flutter ( 4189): Been running for 4.0012289s I/flutter ( 4189): 2021-02-04 22:00:18.252: INFO: >> Matcher - received response I/flutter ( 4189): <<< Response Message >>> I/flutter ( 4189): Type: 2, Code: 2.05 Content, Id: 4968, Token: 00, I/flutter ( 4189): Options = I/flutter ( 4189): [ I/flutter ( 4189): If-Match : I/flutter ( 4189): Uri Host : None I/flutter ( 4189): E-tags : I/flutter ( 4189): None I/flutter ( 4189): Uri Port : None I/flutter ( 4189): Location Paths: Location-Path: hello I/flutter ( 4189): Uri Paths : I/flutter ( 4189): Content-Type : 0 I/flutter ( 4189): Max Age : None I/flutter ( 4189): Uri Queries : I/flutter ( 4189): Accept : -1 I/flutter ( 4189): Location Queries : I/flutter ( 4189): Proxy Uri : None I/flutter ( 4189): Proxy Scheme : None I/flutter ( 4189): Block 1 : None I/flutter ( 4189): Block 2 : None I/flutter ( 4189): Observe : -1 I/flutter ( 4189): Size 1 : 0 I/flutter ( 4189): Size 2 : 0 I/flutter ( 4189): ], I/flutter ( 4189): Payload : I/flutter ( 4189): Been running for 5.0012861s I/flutter ( 4189): 2021-02-04 22:00:18.253: WARNING: >> Matcher - Ignoring unmatchable piggy-backed response from 192.168.0.100 : I/flutter ( 4189): <<< Response Message >>> I/flutter ( 4189): Type: 2, Code: 2.05 Content, Id: 4968, Token: 00, I/flutter ( 4189): Options = I/flutter ( 4189): [ I/flutter ( 4189): If-Match : I/flutter ( 4189): Uri Host : None I/flutter ( 4189): E-tags : I/flutter ( 4189): None I/flutter ( 4189): Uri Port : None I/flutter ( 4189): Location Paths: Location-Path: hello I/flutter ( 4189): Uri Paths : I/flutter ( 4189): Content-Type : 0 I/flutter ( 4189): Max Age : None I/flutter ( 4189): Uri Queries : I/flutter ( 4189): Accept : -1 I/flutter ( 4189): Location Queries : I/flutter ( 4189): Proxy Uri : None I/flutter ( 4189): Proxy Scheme : None I/flutter ( 4189): Block 1 : None I/flutter ( 4189): Block 2 : None I/flutter ( 4189): Observe : -1 I/flutter ( 4189): Size 1 : 0 I/flutter ( 4189): Size 2 : 0 I/flutter ( 4189): ], I/flutter ( 4189): Payload : I/flutter ( 4189): Been running for 5.0012861s I/flutter ( 4189): 2021-02-04 22:00:19.347: INFO: >> Matcher - received response I/flutter ( 4189): <<< Response Message >>> I/flutter ( 4189): Type: 2, Code: 2.05 Content, Id: 4968, Token: 00, I/flutter ( 4189): Options = I/flutter ( 4189): [ I/flutter ( 4189): If-Match : I/flutter ( 4189): Uri Host : None I/flutter ( 4189): E-tags : I/flutter ( 4189): None I/flutter ( 4189): Uri Port : None I/flutter ( 4189): Location Paths: Location-Path: hello I/flutter ( 4189): Uri Paths : I/flutter ( 4189): Content-Type : 0 I/flutter ( 4189): Max Age : None I/flutter ( 4189): Uri Queries : I/flutter ( 4189): Accept : -1 I/flutter ( 4189): Location Queries : I/flutter ( 4189): Proxy Uri : None I/flutter ( 4189): Proxy Scheme : None I/flutter ( 4189): Block 1 : None I/flutter ( 4189): Block 2 : None I/flutter ( 4189): Observe : -1 I/flutter ( 4189): Size 1 : 0 I/flutter ( 4189): Size 2 : 0 I/flutter ( 4189): ], I/flutter ( 4189): Payload : I/flutter ( 4189): Been running for 6.0013433s I/flutter ( 4189): 2021-02-04 22:00:19.348: WARNING: >> Matcher - Ignoring unmatchable piggy-backed response from 192.168.0.100 : I/flutter ( 4189): <<< Response Message >>> I/flutter ( 4189): Type: 2, Code: 2.05 Content, Id: 4968, Token: 00, I/flutter ( 4189): Options = I/flutter ( 4189): [ I/flutter ( 4189): If-Match : I/flutter ( 4189): Uri Host : None I/flutter ( 4189): E-tags : I/flutter ( 4189): None I/flutter ( 4189): Uri Port : None I/flutter ( 4189): Location Paths: Location-Path: hello I/flutter ( 4189): Uri Paths : I/flutter ( 4189): Content-Type : 0 I/flutter ( 4189): Max Age : None I/flutter ( 4189): Uri Queries : I/flutter ( 4189): Accept : -1 I/flutter ( 4189): Location Queries : I/flutter ( 4189): Proxy Uri : None I/flutter ( 4189): Proxy Scheme : None I/flutter ( 4189): Block 1 : None I/flutter ( 4189): Block 2 : None I/flutter ( 4189): Observe : -1 I/flutter ( 4189): Size 1 : 0 I/flutter ( 4189): Size 2 : 0 I/flutter ( 4189): ], I/flutter ( 4189): Payload : I/flutter ( 4189): Been running for 6.0013433s I/flutter ( 4189): 2021-02-04 22:00:20.254: INFO: >> Matcher - received response I/flutter ( 4189): <<< Response Message >>> I/flutter ( 4189): Type: 2, Code: 2.05 Content, Id: 4968, Token: 00, I/flutter ( 4189): Options = I/flutter ( 4189): [ I/flutter ( 4189): If-Match : I/flutter ( 4189): Uri Host : None I/flutter ( 4189): E-tags : I/flutter ( 4189): None I/flutter ( 4189): Uri Port : None I/flutter ( 4189): Location Paths: Location-Path: hello I/flutter ( 4189): Uri Paths : I/flutter ( 4189): Content-Type : 0 I/flutter ( 4189): Max Age : None I/flutter ( 4189): Uri Queries : I/flutter ( 4189): Accept : -1 I/flutter ( 4189): Location Queries : I/flutter ( 4189): Proxy Uri : None I/flutter ( 4189): Proxy Scheme : None I/flutter ( 4189): Block 1 : None I/flutter ( 4189): Block 2 : None I/flutter ( 4189): Observe : -1 I/flutter ( 4189): Size 1 : 0 I/flutter ( 4189): Size 2 : 0 I/flutter ( 4189): ], I/flutter ( 4189): Payload : I/flutter ( 4189): Been running for 7.0014005s I/flutter ( 4189): 2021-02-04 22:00:20.256: WARNING: >> Matcher - Ignoring unmatchable piggy-backed response from 192.168.0.100 : I/flutter ( 4189): <<< Response Message >>> I/flutter ( 4189): Type: 2, Code: 2.05 Content, Id: 4968, Token: 00, I/flutter ( 4189): Options = I/flutter ( 4189): [ I/flutter ( 4189): If-Match : I/flutter ( 4189): Uri Host : None I/flutter ( 4189): E-tags : I/flutter ( 4189): None I/flutter ( 4189): Uri Port : None I/flutter ( 4189): Location Paths: Location-Path: hello I/flutter ( 4189): Uri Paths : I/flutter ( 4189): Content-Type : 0 I/flutter ( 4189): Max Age : None I/flutter ( 4189): Uri Queries : I/flutter ( 4189): Accept : -1 I/flutter ( 4189): Location Queries : I/flutter ( 4189): Proxy Uri : None I/flutter ( 4189): Proxy Scheme : None I/flutter ( 4189): Block 1 : None I/flutter ( 4189): Block 2 : None I/flutter ( 4189): Observe : -1 I/flutter ( 4189): Size 1 : 0 I/flutter ( 4189): Size 2 : 0 I/flutter ( 4189): ], I/flutter ( 4189): Payload : I/flutter ( 4189): Been running for 7.0014005s I/flutter ( 4189): 2021-02-04 22:00:21.058: WARNING: >> Reliability - Retransmission timeout elapsed I/flutter ( 4189): 2021-02-04 22:00:21.058: WARNING: >> Reliability - Timeout: retransmit message, failed count: 2 message: 4968 I/flutter ( 4189): 2021-02-04 22:00:21.059: INFO: >> Reliability - Scheduling transmission for I/flutter ( 4189): <<< Request Message >>> I/flutter ( 4189): Type: 0, Code: GET, Id: 4968, Token: 00006b23, I/flutter ( 4189): Options = I/flutter ( 4189): [ I/flutter ( 4189): If-Match : I/flutter ( 4189): Uri Host : Uri-Host: 192.168.0.100 I/flutter ( 4189): E-tags : I/flutter ( 4189): None I/flutter ( 4189): Uri Port : 5683 I/flutter ( 4189): Location Paths: I/flutter ( 4189): Uri Paths : hello I/flutter ( 4189): Content-Type : None I/flutter ( 4189): Max Age : None I/flutter ( 4189): Uri Queries : I/flutter ( 4189): Accept : None I/flutter ( 4189): Location Queries : I/flutter ( 4189): Proxy Uri : None I/flutter ( 4189): Proxy Scheme : None I/flutter ( 4189): Block 1 : None I/flutter ( 4189): Block 2 : None I/flutter ( 4189): Observe : 1 I/flutter ( 4189): Size 1 : 0 I/flutter ( 4189): Size 2 : 0 I/flutter ( 4189): ], I/flutter ( 4189): Payload : I/flutter ( 4189): null I/flutter ( 4189): 2021-02-04 22:00:21.060: INFO: >> Reliability - sending request, failed transmission count: 2 I/flutter ( 4189): 2021-02-04 22:00:21.062: INFO: >> Reliability - Retransmission timeout is 15684 ms I/flutter ( 4189): 2021-02-04 22:00:21.063: INFO: >> Matcher - Stored open request by KeyID[4968]) + KeyToken[00006b23] I/flutter ( 4189): 2021-02-04 22:00:21.188: INFO: >> Matcher - received response I/flutter ( 4189): <<< Response Message >>> I/flutter ( 4189): Type: 2, Code: 2.05 Content, Id: 4968, Token: 00, I/flutter ( 4189): Options = I/flutter ( 4189): [ I/flutter ( 4189): If-Match : I/flutter ( 4189): Uri Host : None I/flutter ( 4189): E-tags : I/flutter ( 4189): None I/flutter ( 4189): Uri Port : None I/flutter ( 4189): Location Paths: Location-Path: hello I/flutter ( 4189): Uri Paths : I/flutter ( 4189): Content-Type : 0 I/flutter ( 4189): Max Age : None I/flutter ( 4189): Uri Queries : I/flutter ( 4189): Accept : -1 I/flutter ( 4189): Location Queries : I/flutter ( 4189): Proxy Uri : None I/flutter ( 4189): Proxy Scheme : None I/flutter ( 4189): Block 1 : None I/flutter ( 4189): Block 2 : None I/flutter ( 4189): Observe : -1 I/flutter ( 4189): Size 1 : 0 I/flutter ( 4189): Size 2 : 0 I/flutter ( 4189): ], I/flutter ( 4189): Payload : I/flutter ( 4189): Been running for 0s I/flutter ( 4189): 2021-02-04 22:00:21.189: WARNING: >> Matcher - Ignoring unmatchable piggy-backed response from 192.168.0.100 : I/flutter ( 4189): <<< Response Message >>> I/flutter ( 4189): Type: 2, Code: 2.05 Content, Id: 4968, Token: 00, ...

shamblett commented 3 years ago

I'm not a flutter user, I use Dart only in the VM or the web so I don't know how to do do as you request for continuous reception of data. The flutter example was contributed by @pedromassango not me, I suggest you either contact him or ask on a flutter list.

From the spec RFC7252 -

5.2.1 Piggybacked

   In the most basic case, the response is carried directly in the
   Acknowledgement message that acknowledges the request (which requires
   that the request was carried in a Confirmable message).  This is
   called a "Piggybacked Response".

   The response is returned in the Acknowledgement message, independent
   of whether the response indicates success or failure.  In effect, the
   response is piggybacked on the Acknowledgement message, and no
   separate message is required to return the response.

   Implementation Note:  The protocol leaves the decision whether to
      piggyback a response or not (i.e., send a separate response) to
      the server.  The client MUST be prepared to receive either.  On
      the quality-of-implementation level, there is a strong expectation
      that servers will implement code to piggyback whenever possible --
      saving resources in the network and both at the client and at the
      server.

If you want to piggy back you should use confirmable requests, in fact your server shouldn't send an ack with a piggy back if the request is not confirmable, it should use a separate response, see 5.2.2 of the spec.

TerryLiu commented 3 years ago

OK, Thank you @shamblett .

@pedromassango Could you see this issue?

pedromassango commented 3 years ago

Hi, It has been some time since I worked with CoAP.

I think you should call markObserve() and then listen to the responses stream in the same request, then you should get new responses once the server sends it.

Hope this helps

TerryLiu commented 3 years ago

Hi, It has been some time since I worked with CoAP.

I think you should call markObserve() and then listen to the responses stream in the same request, then you should get new responses once the server sends it.

Hope this helps

Thank you @pedromassango . I'm trying do it. At the same time, new problem were pops out #24