shamblett / coap

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

How to pass a IP address in a Flutter App #21

Closed TerryLiu closed 3 years ago

TerryLiu commented 3 years ago

Hi @shamblett , Thanks for your great work,it help me a lot.
The difficulty I have is pass a IP address to CoapClient in a flutter App,when the App and a laptop on the same LAN. The laptop is CoAP server, it only has IP, no domain host. Please suggest the solution. What can I do to make it work? Regards


I tried bindAddress:

 final CoapRequest request = CoapRequest.newGet();
   request.bindAddress= InternetAddress('192.168.0.100');
   request.addUriPath('hello');
   client.request = request;

And add the permission to all of AndroidManifest.xml <uses-permission android:name="android.permission.INTERNET" />


But got the error :

I/flutter (15848): 2021-02-02 11:04:20.482: INFO: >> Reliability - sending request, failed transmission count: 0 I/flutter (15848): 2021-02-02 11:04:20.484: INFO: >> Reliability - Retransmission timeout is 4357 ms I/flutter (15848): 2021-02-02 11:04:20.497: INFO: >> Matcher - Stored open request by KeyID[24968]) + KeyToken[0000170e] I/flutter (15848): 2021-02-02 11:04:20.542: INFO: >> CoapNetworkUDP - binding to InternetAddress('192.168.0.100', IPv4) D/libc-netbsd(15848): [getaddrinfo]: hostname=InternetAddress('192.168.0.100', IPv4); servname=(null); netid=0; mark=0 D/libc-netbsd(15848): [getaddrinfo]: ai_addrlen=0; ai_canonname=(null); ai_flags=1024; ai_family=0 D/libc-netbsd(15848): getaddrinfo: dnsproxy bogus hostname >> D/libc-netbsd(15848): getaddrinfo: InternetAddress('192.168.0.100', IPv4) get result from proxy gai_error = 7 D/libc-netbsd(15848): [getaddrinfo]: hostname=InternetAddress('192.168.0.100', IPv4); servname=(null); netid=0; mark=0 D/libc-netbsd(15848): [getaddrinfo]: ai_addrlen=0; ai_canonname=(null); ai_flags=0; ai_family=0 D/libc-netbsd(15848): getaddrinfo: dnsproxy bogus hostname >> D/libc-netbsd(15848): getaddrinfo: InternetAddress('192.168.0.100', IPv4) get result from proxy gai_error = 7 E/flutter (15848): [ERROR:flutter/lib/ui/ui_dart_state.cc(177)] Unhandled Exception: SocketException: Failed host lookup: 'InternetAddress('192.168.0.100', IPv4)' (OS Error: No address associated with hostname, errno = 7) E/flutter (15848): #0 _NativeSocket.lookup. (dart:io-patch/socket_patch.dart:502:9) E/flutter (15848): #1 _rootRunUnary (dart:async/zone.dart:1198:47) E/flutter (15848): #2 _CustomZone.runUnary (dart:async/zone.dart:1100:19) E/flutter (15848): #3 _FutureListener.handleValue (dart:async/future_impl.dart:143:18) E/flutter (15848): #4 Future._propagateToListeners.handleValueCallback (dart:async/future_impl.dart:696:45) E/flutter (15848): #5 Future._propagateToListeners (dart:async/future_impl.dart:725:32) E/flutter (15848): #6 Future._completeWithValue (dart:async/future_impl.dart:529:5) E/flutter (15848): #7 Future._asyncCompleteWithValue. (dart:async/future_impl.dart:567:7) E/flutter (15848): #8 _rootRun (dart:async/zone.dart:1190:13) E/flutter (15848): #9 _CustomZone.run (dart:async/zone.dart:1093:19) E/flutter (15848): #10 _CustomZone.runGuarded (dart:async/zone.dart:997:7) E/flutter (15848): #11 _CustomZone.bindCallbackGuarded. (dart:async/zone.dart:1037:23) E/flutter (15848): #12 _microtaskLoop (dart:async/schedule_microtask.dart:41:21) E/flutter (15848): #13 _startMicrotaskLoop (dart:async/schedule_microtask.dart:50:5) E/flutter (15848): E/flutter (15848): [ERROR:flutter/lib/ui/ui_dart_state.cc(177)] Unhandled Exception: SocketException: Failed host lookup: 'InternetAddress('192.168.0.100', IPv4)' (OS Error: No address associated with hostname, errno = 7) E/flutter (15848): #0 _NativeSocket.lookup. (dart:io-patch/socket_patch.dart:502:9) E/flutter (15848): #1 _rootRunUnary (dart:async/zone.dart:1198:47) E/flutter (15848): #2 _CustomZone.runUnary (dart:async/zone.dart:1100:19) E/flutter (15848): #3 _FutureListener.handleValue (dart:async/future_impl.dart:143:18) E/flutter (15848): #4 Future._propagateToListeners.handleValueCallback (dart:async/future_impl.dart:696:45) E/flutter (15848): #5 Future._propagateToListeners (dart:async/future_impl.dart:725:32) E/flutter (15848): #6 Future._completeWithValue (dart:async/future_impl.dart:529:5) E/flutter (15848): #7 Future._asyncCompleteWithValue. (dart:async/future_impl.dart:567:7) E/flutter (15848): #8 _rootRun (dart:async/zone.dart:1190:13) E/flutter (15848): #9 _CustomZone.run (dart:async/zone.dart:1093:19) E/flutter (15848): #10 _CustomZone.runGuarded (dart:async/zone.dart:997:7) E/flutter (15848): #11 _CustomZone.bindCallbackGuarded. (dart:async/zone.dart:1037:23) E/flutter (15848): #12 _microtaskLoop (dart:async/schedule_microtask.dart:41:21) E/flutter (15848): #13 _startMicrotaskLoop (dart:async/schedule_microtask.dart:50:5) E/flutter (15848):

BTW, using a real domain host is fine.

shamblett commented 3 years ago

Interesting, if you look at the example discover_resources.dart you can see that the host is set to 'coap.me', if you change this to the ip address '134.102.218.18' it works OK, so the VM can take a hostname or IP address which is what I thought. It looks as though this doesn't work on an android device. I will update the code so that if you supply an IP address it doesn't try and resolve it, until then you may be able to work around it, see this and other similar posts.

TerryLiu commented 3 years ago

Thank you for your reply quickly. The flutter App haven't like "/etc/hosts" file similarly, and localhost didn't have effect caused by the server is a different device. The flutter App build from your flutter example/flutter/main.dar.

The version I used is v2.0.2 of master. my latest CoAP server IP address is 124.71.151.247

Future<void> _loadData() async {
   final Uri uri = Uri(scheme: 'coap',host:'124.71.151.247', port: 5688);
   final CoapClient client = CoapClient(uri, config);
   final CoapRequest request = CoapRequest.newGet();

Unfortunately, it doesn't work. Looking forward to your updates. I could live online testing recently if you need it.

BTW, the error info Bad state: Cannot add new events after calling close seemingly need to be solved


I/flutter (20059): 2021-02-02 19:11:19.001: INFO: >> Reliability - sending request, failed transmission count: 3 I/flutter (20059): 2021-02-02 19:11:19.002: INFO: >> Reliability - Retransmission timeout is 35504 ms I/flutter (20059): 2021-02-02 19:11:19.003: INFO: >> Matcher - Stored open request by KeyID[5451]) + KeyToken[00007f4e] E/flutter (20059): [ERROR:flutter/lib/ui/ui_dart_state.cc(177)] Unhandled Exception: Bad state: Cannot add new events after calling close E/flutter (20059): #0 _BroadcastStreamController.add (dart:async/broadcast_stream_controller.dart:249:24) E/flutter (20059): #1 EventBus.fire (package:event_bus/event_bus.dart:61:22) E/flutter (20059): #2 CoapEventBus.fire (package:coap/src/event/coap_event_bus.dart:153:17) E/flutter (20059): #3 CoapEndPoint.sendRequest (package:coap/src/net/coap_endpoint.dart:177:15) E/flutter (20059): #4 CoapStackBottomLayer.sendRequest (package:coap/src/stack/coap_layer_stack.dart:110:21) E/flutter (20059): #5 CoapNextLayer.sendRequest (package:coap/src/stack/coap_layer_stack.dart:20:10) E/flutter (20059): #6 CoapAbstractLayer.sendRequest (package:coap/src/stack/coap_abstract_layer.dart:18:15) E/flutter (20059): #7 CoapReliabilityLayer.sendRequest (package:coap/src/stack/coap_reliability_layer.dart:139:11) E/flutter (20059): #8 CoapReliabilityLayer.sendRequest. (package:coap/src/stack/coap_reliability_layer.dart:136:28) E/flutter (20059): #9 CoapTransmissionContext._timerElapsed (package:coap/src/stack/coap_reliability_layer.dart:97:20) E/flutter (20059): #10 _rootRun (dart:async/zone.dart:1182:47) E/flutter (20059): #11 _CustomZone.run (dart:async/zone.dart:1093:19) E/flutter (20059): #12 _CustomZone.runGuarded (dart:async/zone.dart:997:7) E/flutter (20059): #13 _CustomZone.bindCallbackGuarded. (dart:async/zone.dart:1037:23) E/flutter (20059): #14 _rootRun (dart:async/zone.dart:1190:13) E/flutter (20059): #15 _CustomZone.run (dart:async/zone.dart:1093:19) E/flutter (20059): #16 _CustomZone.bindCallback. (dart:async/zone.dart:1021:23) E/flutter (20059): #17 Timer._createTimer. (dart:async-patch/timer_patch.dart:18:15) E/flutter (20059): #18 _Timer._runTimers (dart:isolate-patch/timer_impl.dart:397:19) E/flutter (20059): #19 _Timer._handleMessage (dart:isolate-patch/timer_impl.dart:428:5) E/flutter (20059): #20 _RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dart:168:12) E/flutter (20059): I/flutter (20059): 2021-02-02 19:11:20.673: INFO: >> Close - closing client I/flutter (20059): 2021-02-02 19:11:20.674: INFO: >> Endpoint - stopping endpoint bound to InternetAddress('124.71.151.247', IPv4) I/flutter (20059): 2021-02-02 19:11:20.675: INFO: >> Network UDP - closing 124.71.151.247, port 5688 I/flutter (20059): 2021-02-02 19:11:20.676: INFO: >> Stopping Mark-And-Sweep I/flutter (20059): 2021-02-02 19:11:20.678: INFO: >> Network UDP - closing 124.71.151.247, port 5688

shamblett commented 3 years ago

I've updated the code, you should now be able to specify an IP address as the host name. Re published the package at 2.0.3, please update to this version and re test.

TerryLiu commented 3 years ago

I've updated the code, you should now be able to specify an IP address as the host name. Re published the package at 2.0.3, please update to this version and re test.

Only first time works ok ....and then failed. See the log: (I use Copper with firefox GET coap://134.102.218.18:5683/hello, it was a success every time)

I/flutter (23240): 2021-02-02 20:07:32.083: INFO: >> CoapUtils:lookupHost host '134.102.218.18' is an IP address, not resolving I/flutter (23240): 2021-02-02 20:07:32.204: SEVERE: >> BlockwiseLayer uses MaxMessageSize: 1024 and DefaultBlockSize: 512 I/flutter (23240): 2021-02-02 20:07:32.225: INFO: >> CoapNetworkUDP - binding to 0.0.0.0 D/libc-netbsd(23240): [getaddrinfo]: hostname=0.0.0.0; servname=(null); netid=0; mark=0 D/libc-netbsd(23240): [getaddrinfo]: ai_addrlen=0; ai_canonname=(null); ai_flags=1024; ai_family=0 I/flutter (23240): 2021-02-02 20:07:32.263: INFO: >> Starting endpoint bound to InternetAddress('134.102.218.18', IPv4) I/flutter (23240): 2021-02-02 20:07:32.366: INFO: >> Reliability - Scheduling transmission for I/flutter (23240): <<< Request Message >>> I/flutter (23240): Type: 0, Code: GET, Id: 23145, Token: 00000c3e, I/flutter (23240): Options = I/flutter (23240): [ I/flutter (23240): If-Match : I/flutter (23240): Uri Host : Uri-Host: 134.102.218.18 I/flutter (23240): E-tags : I/flutter (23240): None I/flutter (23240): Uri Port : 5683 I/flutter (23240): Location Paths: I/flutter (23240): Uri Paths : hello I/flutter (23240): Content-Type : None I/flutter (23240): Max Age : None I/flutter (23240): Uri Queries : I/flutter (23240): Accept : None I/flutter (23240): Location Queries : I/flutter (23240): Proxy Uri : None I/flutter (23240): Proxy Scheme : None I/flutter (23240): Block 1 : None I/flutter (23240): Block 2 : None I/flutter (23240): Observe : -1 I/flutter (23240): Size 1 : 0 I/flutter (23240): Size 2 : 0 I/flutter (23240): ], I/flutter (23240): Payload : I/flutter (23240): null I/flutter (23240): 2021-02-02 20:07:32.377: INFO: >> Reliability - sending request, failed transmission count: 0 I/flutter (23240): 2021-02-02 20:07:32.381: INFO: >> Reliability - Retransmission timeout is 4447 ms I/flutter (23240): 2021-02-02 20:07:32.400: INFO: >> Matcher - Stored open request by KeyID[23145]) + KeyToken[00000c3e] I/flutter (23240): 2021-02-02 20:07:32.459: INFO: >> CoapNetworkUDP - binding to 0.0.0.0 D/libc-netbsd(23240): [getaddrinfo]: hostname=0.0.0.0; servname=(null); netid=0; mark=0 D/libc-netbsd(23240): [getaddrinfo]: ai_addrlen=0; ai_canonname=(null); ai_flags=1024; ai_family=0 I/flutter (23240): 2021-02-02 20:07:36.845: WARNING: >> Reliability - Retransmission timeout elapsed I/flutter (23240): 2021-02-02 20:07:36.849: WARNING: >> Reliability - Timeout: retransmit message, failed count: 1 message: 23145 I/flutter (23240): 2021-02-02 20:07:36.852: INFO: >> Reliability - Scheduling transmission for I/flutter (23240): <<< Request Message >>> I/flutter (23240): Type: 0, Code: GET, Id: 23145, Token: 00000c3e, I/flutter (23240): Options = I/flutter (23240): [ I/flutter (23240): If-Match : I/flutter (23240): Uri Host : Uri-Host: 134.102.218.18 I/flutter (23240): E-tags : I/flutter (23240): None I/flutter (23240): Uri Port : 5683 I/flutter (23240): Location Paths: I/flutter (23240): Uri Paths : hello I/flutter (23240): Content-Type : None I/flutter (23240): Max Age : None I/flutter (23240): Uri Queries : I/flutter (23240): Accept : None I/flutter (23240): Location Queries : I/flutter (23240): Proxy Uri : None I/flutter (23240): Proxy Scheme : None I/flutter (23240): Block 1 : None I/flutter (23240): Block 2 : None I/flutter (23240): Observe : -1 I/flutter (23240): Size 1 : 0 I/flutter (23240): Size 2 : 0 I/flutter (23240): ], I/flutter (23240): Payload : I/flutter (23240): null I/flutter (23240): 2021-02-02 20:07:36.854: INFO: >> Reliability - sending request, failed transmission count: 1 I/flutter (23240): 2021-02-02 20:07:36.855: INFO: >> Reliability - Retransmission timeout is 8894 ms I/flutter (23240): 2021-02-02 20:07:36.857: INFO: >> Matcher - Stored open request by KeyID[23145]) + KeyToken[00000c3e] I/flutter (23240): 2021-02-02 20:07:37.362: INFO: >> Matcher - received response I/flutter (23240): <<< Response Message >>> I/flutter (23240): Type: 2, Code: 2.05 Content, Id: 23145, Token: 00000c3e, I/flutter (23240): Options = I/flutter (23240): [ I/flutter (23240): If-Match : I/flutter (23240): Uri Host : None I/flutter (23240): E-tags : I/flutter (23240): None I/flutter (23240): Uri Port : None I/flutter (23240): Location Paths: I/flutter (23240): Uri Paths : I/flutter (23240): Content-Type : 0 I/flutter (23240): Max Age : None I/flutter (23240): Uri Queries : I/flutter (23240): Accept : -1 I/flutter (23240): Location Queries : I/flutter (23240): Proxy Uri : None I/flutter (23240): Proxy Scheme : None I/flutter (23240): Block 1 : None I/flutter (23240): Block 2 : None I/flutter (23240): Observe : -1 I/flutter (23240): Size 1 : 0 I/flutter (23240): Size 2 : 0 I/flutter (23240): ], I/flutter (23240): Payload : I/flutter (23240): world I/flutter (23240): 2021-02-02 20:07:37.364: INFO: >> Matcher - cleaning up KeyID[23145]) I/flutter (23240): 2021-02-02 20:07:37.372: INFO: >> Reliability - Cancel retransmission for token: 00000c3e id: 23145 I/flutter (23240): 2021-02-02 20:07:37.406: INFO: >> Close - closing client I/flutter (23240): 2021-02-02 20:07:37.408: INFO: >> Endpoint - stopping endpoint bound to InternetAddress('134.102.218.18', IPv4) I/flutter (23240): 2021-02-02 20:07:37.410: INFO: >> Network UDP - closing 134.102.218.18, port 5683 I/flutter (23240): 2021-02-02 20:07:37.417: INFO: >> Stopping Mark-And-Sweep I/flutter (23240): 2021-02-02 20:07:37.423: INFO: >> Matcher - Exchange completed: Cleaning up KeyToken[00000c3e] I/flutter (23240): 2021-02-02 20:07:37.473: INFO: >> Network UDP - closing 134.102.218.18, port 5683 V/AudioManager(23240): playSoundEffect effectType: 0 V/AudioManager(23240): querySoundEffectsEnabled... I/flutter (23240): 2021-02-02 20:09:55.551: INFO: >> CoapUtils:lookupHost host '134.102.218.18' is an IP address, not resolving I/flutter (23240): 2021-02-02 20:09:55.556: SEVERE: >> BlockwiseLayer uses MaxMessageSize: 1024 and DefaultBlockSize: 512 I/flutter (23240): 2021-02-02 20:09:55.558: INFO: >> CoapNetworkUDP - binding to 0.0.0.0 D/libc-netbsd(23240): [getaddrinfo]: hostname=0.0.0.0; servname=(null); netid=0; mark=0 D/libc-netbsd(23240): [getaddrinfo]: ai_addrlen=0; ai_canonname=(null); ai_flags=1024; ai_family=0 I/flutter (23240): 2021-02-02 20:09:55.559: INFO: >> Starting endpoint bound to InternetAddress('134.102.218.18', IPv4) I/flutter (23240): 2021-02-02 20:09:55.564: INFO: >> Reliability - Scheduling transmission for I/flutter (23240): <<< Request Message >>> I/flutter (23240): Type: 0, Code: GET, Id: 24891, Token: 00002348, I/flutter (23240): Options = I/flutter (23240): [ I/flutter (23240): If-Match : I/flutter (23240): Uri Host : Uri-Host: 134.102.218.18 I/flutter (23240): E-tags : I/flutter (23240): None I/flutter (23240): Uri Port : 5683 I/flutter (23240): Location Paths: I/flutter (23240): Uri Paths : hello I/flutter (23240): Content-Type : None I/flutter (23240): Max Age : None I/flutter (23240): Uri Queries : I/flutter (23240): Accept : None I/flutter (23240): Location Queries : I/flutter (23240): Proxy Uri : None I/flutter (23240): Proxy Scheme : None I/flutter (23240): Block 1 : None I/flutter (23240): Block 2 : None I/flutter (23240): Observe : -1 I/flutter (23240): Size 1 : 0 I/flutter (23240): Size 2 : 0 I/flutter (23240): ], I/flutter (23240): Payload : I/flutter (23240): null I/flutter (23240): 2021-02-02 20:09:55.565: INFO: >> Reliability - sending request, failed transmission count: 0 I/flutter (23240): 2021-02-02 20:09:55.566: INFO: >> Reliability - Retransmission timeout is 3033 ms I/flutter (23240): 2021-02-02 20:09:55.568: INFO: >> Matcher - Stored open request by KeyID[24891]) + KeyToken[00002348] E/flutter (23240): [ERROR:flutter/lib/ui/ui_dart_state.cc(177)] Unhandled Exception: Bad state: Cannot add new events after calling close E/flutter (23240): #0 _BroadcastStreamController.add (dart:async/broadcast_stream_controller.dart:249:24) E/flutter (23240): #1 EventBus.fire (package:event_bus/event_bus.dart:61:22) E/flutter (23240): #2 CoapEventBus.fire (package:coap/src/event/coap_event_bus.dart:153:17) E/flutter (23240): #3 CoapEndPoint.sendRequest (package:coap/src/net/coap_endpoint.dart:177:15) E/flutter (23240): #4 CoapStackBottomLayer.sendRequest (package:coap/src/stack/coap_layer_stack.dart:110:21) E/flutter (23240): #5 CoapNextLayer.sendRequest (package:coap/src/stack/coap_layer_stack.dart:20:10) E/flutter (23240): #6 CoapAbstractLayer.sendRequest (package:coap/src/stack/coap_abstract_layer.dart:18:15) E/flutter (23240): #7 CoapReliabilityLayer.sendRequest (package:coap/src/stack/coap_reliability_layer.dart:139:11) E/flutter (23240): #8 CoapNextLayer.sendRequest (package:coap/src/stack/coap_layer_stack.dart:20:10) E/flutter (23240): #9 CoapAbstractLayer.sendRequest (package:coap/src/stack/coap_abstract_layer.dart:18:15) E/flutter (23240): #10 CoapTokenLayer.sendRequest (package:coap/src/stack/coap_token_layer.dart:28:11) E/flutter (23240): #11 CoapNextLayer.sendRequest (package:coap/src/stack/coap_layer_stack.dart:20:10) E/flutter (23240): #12 CoapAbstractLayer.sendRequest (package:coap/src/stack/coap_abstract_layer.dart:18:15) E/flutter (23240): #13 CoapBlockwiseLayer.sendRequest (package:coap/src/stack/coap_blockwise_layer.dart:56:13) E/flutter (23240): #14 CoapNextLayer.sendRequest (package:coap/src/stack/coap_layer_stack.dart:20:10) E/flutter (23240): #15 CoapAbstractLayer.sendRequest (package:coap/src/stack/coap_abstract_layer.dart:18:15) E/flutter (23240): #16 CoapNextLayer.sendRequest (package:coap/src/stack/coap_layer_stack.dart:20:10) E/flutter (23240): #17 CoapAbstractLayer.sendRequest (package:coap/src/stack/coap_abstract_layer.dart:18:15) E/flutter (23240): #18 CoapStackTopLayer.sendRequest (package:coap/src/stack/coap_layer_stack.dart:66:11) E/flutter (23240): #19 CoapLayerStack.sendRequest (package:coap/src/stack/coap_layer_stack.dart:136:17) E/flutter (23240): #20 CoapEndPoint.sendEpRequest. (package:coap/src/net/coap_endpoint.dart:82:37) E/flutter (23240): #21 CoapExecutor.start. (package:coap/src/threading/coap_executor.dart:18:11) E/flutter (23240): #22 _Executor.scheduleTask (package:executor/src/executor_impl.dart:61:29) E/flutter (23240): E/flutter (23240): #23 CoapExecutor.start (package:coap/src/threading/coap_executor.dart:17:14) E/flutter (23240): #24 CoapEndPoint.sendEpRequest (package:coap/src/net/coap_endpoint.dart:82:14) E/flutter (23240): #25 CoapRequest.send (package:coap/src/coap_request.dart:119:14) E/flutter (23240): #26 CoapClient.send (package:coap/src/coap_client.dart:274:20) E/flutter (23240): E/flutter (23240): #27 CoapClient.get (package:coap/src/coap_client.dart:112:12) E/flutter (23240): #28 _MyHomePageState._loadData (package:flutter_firstapp/main.dart:60:47) E/flutter (23240): #29 _InkResponseState._handleTap (package:flutter/src/material/ink_well.dart:993:19) E/flutter (23240): #30 _InkResponseState.build. (package:flutter/src/material/ink_well.dart:1111:38) E/flutter (23240): #31 GestureRecognizer.invokeCallback (package:flutter/src/gestures/recognizer.dart:183:24) E/flutter (23240): #32 TapGestureRecognizer.handleTapUp (package:flutter/src/gestures/tap.dart:598:11) E/flutter (23240): #33 BaseTapGestureRecognizer._checkUp (package:flutter/src/gestures/tap.dart:287:5) E/flutter (23240): #34 BaseTapGestureRecognizer.acceptGesture (package:flutter/src/gestures/tap.dart:259:7) E/flutter (23240): #35 GestureArenaManager.sweep (package:flutter/src/gestures/arena.dart:157:27) E/flutter (23240): #36 GestureBinding.handleEvent (package:flutter/src/gestures/binding.dart:362:20) E/flutter (23240): #37 GestureBinding.dispatchEvent (package:flutter/src/gestures/binding.dart:338:22) E/flutter (23240): #38 RendererBinding.dispatchEvent (package:flutter/src/rendering/binding.dart:267:11) E/flutter (23240): #39 GestureBinding._handlePointerEvent (package:flutter/src/gestures/binding.dart:295:7) E/flutter (23240): #40 GestureBinding._flushPointerEventQueue (package:flutter/src/gestures/binding.dart:240:7) E/flutter (23240): #41 GestureBinding._handlePointerDataPacket (package:flutter/src/gestures/binding.dart:213:7) E/flutter (23240): #42 _rootRunUnary (dart:async/zone.dart:1206:13) E/flutter (23240): #43 _CustomZone.runUnary (dart:async/zone.dart:1100:19) E/flutter (23240): #44 _CustomZone.runUnaryGuarded (dart:async/zone.dart:1005:7) E/flutter (23240): #45 _invoke1 I/flutter (23240): 2021-02-02 20:09:58.603: WARNING: >> Reliability - Retransmission timeout elapsed I/flutter (23240): 2021-02-02 20:09:58.604: WARNING: >> Reliability - Timeout: retransmit message, failed count: 1 message: 24891 I/flutter (23240): 2021-02-02 20:09:58.607: INFO: >> Reliability - Scheduling transmission for I/flutter (23240): <<< Request Message >>> I/flutter (23240): Type: 0, Code: GET, Id: 24891, Token: 00002348, I/flutter (23240): Options = I/flutter (23240): [ I/flutter (23240): If-Match : I/flutter (23240): Uri Host : Uri-Host: 134.102.218.18 I/flutter (23240): E-tags : I/flutter (23240): None I/flutter (23240): Uri Port : 5683 I/flutter (23240): Location Paths: I/flutter (23240): Uri Paths : hello I/flutter (23240): Content-Type : None I/flutter (23240): Max Age : None I/flutter (23240): Uri Queries : I/flutter (23240): Accept : None I/flutter (23240): Location Queries : I/flutter (23240): Proxy Uri : None I/flutter (23240): Proxy Scheme : None I/flutter (23240): Block 1 : None I/flutter (23240): Block 2 : None I/flutter (23240): Observe : -1 I/flutter (23240): Size 1 : 0 I/flutter (23240): Size 2 : 0 I/flutter (23240): ], I/flutter (23240): Payload : I/flutter (23240): null I/flutter (23240): 2021-02-02 20:09:58.608: INFO: >> Reliability - sending request, failed transmission count: 1 I/flutter (23240): 2021-02-02 20:09:58.609: INFO: >> Reliability - Retransmission timeout is 6066 ms I/flutter (23240): 2021-02-02 20:09:58.611: INFO: >> Matcher - Stored open request by KeyID[24891]) + KeyToken[00002348] E/flutter (23240): [ERROR:flutter/lib/ui/ui_dart_state.cc(177)] Unhandled Exception: Bad state: Cannot add new events after calling close E/flutter (23240): #0 _BroadcastStreamController.add (dart:async/broadcast_stream_controller.dart:249:24) E/flutter (23240): #1 EventBus.fire (package:event_bus/event_bus.dart:61:22) E/flutter (23240): #2 CoapEventBus.fire (package:coap/src/event/coap_event_bus.dart:153:17) E/flutter (23240): #3 CoapEndPoint.sendRequest (package:coap/src/net/coap_endpoint.dart:177:15) E/flutter (23240): #4 CoapStackBottomLayer.sendRequest (package:coap/src/stack/coap_layer_stack.dart:110:21) E/flutter (23240): #5 CoapNextLayer.sendRequest (package:coap/src/stack/coap_layer_stack.dart:20:10) E/flutter (23240): #6 CoapAbstractLayer.sendRequest (package:coap/src/stack/coap_abstract_layer.dart:18:15) E/flutter (23240): #7 CoapReliabilityLayer.sendRequest (package:coap/src/stack/coap_reliability_layer.dart:139:11) E/flutter (23240): #8 CoapReliabilityLayer.sendRequest. (package:coap/src/stack/coap_reliability_layer.dart:136:28) E/flutter (23240): #9 CoapTransmissionContext._timerElapsed (package:coap/src/stack/coap_reliability_layer.dart:97:20) E/flutter (23240): #10 _rootRun (dart:async/zone.dart:1182:47) E/flutter (23240): #11 _CustomZone.run (dart:async/zone.dart:1093:19) E/flutter (23240): #12 _CustomZone.runGuarded (dart:async/zone.dart:997:7) E/flutter (23240): #13 _CustomZone.bindCallbackGuarded. (dart:async/zone.dart:1037:23) E/flutter (23240): #14 _rootRun (dart:async/zone.dart:1190:13) E/flutter (23240): #15 _CustomZone.run (dart:async/zone.dart:1093:19) E/flutter (23240): #16 _CustomZone.bindCallback. (dart:async/zone.dart:1021:23) E/flutter (23240): #17 Timer._createTimer. (dart:async-patch/timer_patch.dart:18:15) E/flutter (23240): #18 _Timer._runTimers (dart:isolate-patch/timer_impl.dart:397:19) E/flutter (23240): #19 _Timer._handleMessage (dart:isolate-patch/timer_impl.dart:428:5) E/flutter (23240): #20 _RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dart:168:12) E/flutter (23240): I/flutter (23240): 2021-02-02 20:10:04.679: WARNING: >> Reliability - Retransmission timeout elapsed I/flutter (23240): 2021-02-02 20:10:04.680: WARNING: >> Reliability - Timeout: retransmit message, failed count: 2 message: 24891 I/flutter (23240): 2021-02-02 20:10:04.682: INFO: >> Reliability - Scheduling transmission for I/flutter (23240): <<< Request Message >>> I/flutter (23240): Type: 0, Code: GET, Id: 24891, Token: 00002348, I/flutter (23240): Options = I/flutter (23240): [ I/flutter (23240): If-Match : I/flutter (23240): Uri Host : Uri-Host: 134.102.218.18 I/flutter (23240): E-tags : I/flutter (23240): None I/flutter (23240): Uri Port : 5683 I/flutter (23240): Location Paths: I/flutter (23240): Uri Paths : hello I/flutter (23240): Content-Type : None I/flutter (23240): Max Age : None I/flutter (23240): Uri Queries : I/flutter (23240): Accept : None I/flutter (23240): Location Queries : I/flutter (23240): Proxy Uri : None I/flutter (23240): Proxy Scheme : None I/flutter (23240): Block 1 : None I/flutter (23240): Block 2 : None I/flutter (23240): Observe : -1 I/flutter (23240): Size 1 : 0 I/flutter (23240): Size 2 : 0 I/flutter (23240): ], I/flutter (23240): Payload : I/flutter (23240): null I/flutter (23240): 2021-02-02 20:10:04.684: INFO: >> Reliability - sending request, failed transmission count: 2 I/flutter (23240): 2021-02-02 20:10:04.685: INFO: >> Reliability - Retransmission timeout is 12132 ms I/flutter (23240): 2021-02-02 20:10:04.687: INFO: >> Matcher - Stored open request by KeyID[24891]) + KeyToken[00002348] E/flutter (23240): [ERROR:flutter/lib/ui/ui_dart_state.cc(177)] Unhandled Exception: Bad state: Cannot add new events after calling close E/flutter (23240): #0 _BroadcastStreamController.add (dart:async/broadcast_stream_controller.dart:249:24) E/flutter (23240): #1 EventBus.fire (package:event_bus/event_bus.dart:61:22) E/flutter (23240): #2 CoapEventBus.fire (package:coap/src/event/coap_event_bus.dart:153:17) E/flutter (23240): #3 CoapEndPoint.sendRequest (package:coap/src/net/coap_endpoint.dart:177:15) E/flutter (23240): #4 CoapStackBottomLayer.sendRequest (package:coap/src/stack/coap_layer_stack.dart:110:21) E/flutter (23240): #5 CoapNextLayer.sendRequest (package:coap/src/stack/coap_layer_stack.dart:20:10) E/flutter (23240): #6 CoapAbstractLayer.sendRequest (package:coap/src/stack/coap_abstract_layer.dart:18:15) E/flutter (23240): #7 CoapReliabilityLayer.sendRequest (package:coap/src/stack/coap_reliability_layer.dart:139:11) E/flutter (23240): #8 CoapReliabilityLayer.sendRequest. (package:coap/src/stack/coap_reliability_layer.dart:136:28) E/flutter (23240): #9 CoapTransmissionContext._timerElapsed (package:coap/src/stack/coap_reliability_layer.dart:97:20) E/flutter (23240): #10 _rootRun (dart:async/zone.dart:1182:47) E/flutter (23240): #11 _CustomZone.run (dart:async/zone.dart:1093:19) E/flutter (23240): #12 _CustomZone.runGuarded (dart:async/zone.dart:997:7) E/flutter (23240): #13 _CustomZone.bindCallbackGuarded. (dart:async/zone.dart:1037:23) E/flutter (23240): #14 _rootRun (dart:async/zone.dart:1190:13) E/flutter (23240): #15 _CustomZone.run (dart:async/zone.dart:1093:19) E/flutter (23240): #16 _CustomZone.bindCallback. (dart:async/zone.dart:1021:23) E/flutter (23240): #17 Timer._createTimer. (dart:async-patch/timer_patch.dart:18:15) E/flutter (23240): #18 _Timer._runTimers (dart:isolate-patch/timer_impl.dart:397:19) E/flutter (23240): #19 _Timer._handleMessage (dart:isolate-patch/timer_impl.dart:428:5) E/flutter (23240): #20 _RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dart:168:12) E/flutter (23240): I/flutter (23240): 2021-02-02 20:10:05.564: INFO: >> Start Mark-And-Sweep with 0 entries I/flutter (23240): 2021-02-02 20:10:15.560: INFO: >> Start Mark-And-Sweep with 0 entries I/flutter (23240): 2021-02-02 20:10:16.822: WARNING: >> Reliability - Retransmission timeout elapsed I/flutter (23240): 2021-02-02 20:10:16.827: WARNING: >> Reliability - Timeout: retransmit message, failed count: 3 message: 24891 I/flutter (23240): 2021-02-02 20:10:16.831: INFO: >> Reliability - Scheduling transmission for I/flutter (23240): <<< Request Message >>> I/flutter (23240): Type: 0, Code: GET, Id: 24891, Token: 00002348, I/flutter (23240): Options = I/flutter (23240): [ I/flutter (23240): If-Match : I/flutter (23240): Uri Host : Uri-Host: 134.102.218.18 I/flutter (23240): E-tags : I/flutter (23240): None I/flutter (23240): Uri Port : 5683 I/flutter (23240): Location Paths: I/flutter (23240): Uri Paths : hello I/flutter (23240): Content-Type : None I/flutter (23240): Max Age : None I/flutter (23240): Uri Queries : I/flutter (23240): Accept : None I/flutter (23240): Location Queries : I/flutter (23240): Proxy Uri : None I/flutter (23240): Proxy Scheme : None I/flutter (23240): Block 1 : None I/flutter (23240): Block 2 : None I/flutter (23240): Observe : -1 I/flutter (23240): Size 1 : 0 I/flutter (23240): Size 2 : 0 I/flutter (23240): ], I/flutter (23240): Payload : I/flutter (23240): null I/flutter (23240): 2021-02-02 20:10:16.832: INFO: >> Reliability - sending request, failed transmission count: 3 I/flutter (23240): 2021-02-02 20:10:16.834: INFO: >> Reliability - Retransmission timeout is 24264 ms I/flutter (23240): 2021-02-02 20:10:16.836: INFO: >> Matcher - Stored open request by KeyID[24891]) + KeyToken[00002348] E/flutter (23240): [ERROR:flutter/lib/ui/ui_dart_state.cc(177)] Unhandled Exception: Bad state: Cannot add new events after calling close E/flutter (23240): #0 _BroadcastStreamController.add (dart:async/broadcast_stream_controller.dart:249:24) E/flutter (23240): #1 EventBus.fire (package:event_bus/event_bus.dart:61:22) E/flutter (23240): #2 CoapEventBus.fire (package:coap/src/event/coap_event_bus.dart:153:17) E/flutter (23240): #3 CoapEndPoint.sendRequest (package:coap/src/net/coap_endpoint.dart:177:15) E/flutter (23240): #4 CoapStackBottomLayer.sendRequest (package:coap/src/stack/coap_layer_stack.dart:110:21) E/flutter (23240): #5 CoapNextLayer.sendRequest (package:coap/src/stack/coap_layer_stack.dart:20:10) E/flutter (23240): #6 CoapAbstractLayer.sendRequest (package:coap/src/stack/coap_abstract_layer.dart:18:15) E/flutter (23240): #7 CoapReliabilityLayer.sendRequest (package:coap/src/stack/coap_reliability_layer.dart:139:11) E/flutter (23240): #8 CoapReliabilityLayer.sendRequest. (package:coap/src/stack/coap_reliability_layer.dart:136:28) E/flutter (23240): #9 CoapTransmissionContext._timerElapsed (package:coap/src/stack/coap_reliability_layer.dart:97:20) E/flutter (23240): #10 _rootRun (dart:async/zone.dart:1182:47) E/flutter (23240): #11 _CustomZone.run (dart:async/zone.dart:1093:19) E/flutter (23240): #12 _CustomZone.runGuarded (dart:async/zone.dart:997:7) E/flutter (23240): #13 _CustomZone.bindCallbackGuarded. (dart:async/zone.dart:1037:23) E/flutter (23240): #14 _rootRun (dart:async/zone.dart:1190:13) E/flutter (23240): #15 _CustomZone.run (dart:async/zone.dart:1093:19) E/flutter (23240): #16 _CustomZone.bindCallback. (dart:async/zone.dart:1021:23) E/flutter (23240): #17 Timer._createTimer. (dart:async-patch/timer_patch.dart:18:15) E/flutter (23240): #18 _Timer._runTimers (dart:isolate-patch/timer_impl.dart:397:19) E/flutter (23240): #19 _Timer._handleMessage (dart:isolate-patch/timer_impl.dart:428:5) E/flutter (23240): #20 _RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dart:168:12) E/flutter (23240): I/flutter (23240): 2021-02-02 20:10:25.560: INFO: >> Start Mark-And-Sweep with 0 entries I/flutter (23240): 2021-02-02 20:10:28.336: INFO: >> Close - closing client I/flutter (23240): 2021-02-02 20:10:28.337: INFO: >> Endpoint - stopping endpoint bound to InternetAddress('134.102.218.18', IPv4) I/flutter (23240): 2021-02-02 20:10:28.339: INFO: >> Network UDP - closing 134.102.218.18, port 5683 I/flutter (23240): 2021-02-02 20:10:28.341: INFO: >> Stopping Mark-And-Sweep I/flutter (23240): 2021-02-02 20:10:28.347: INFO: >> Network UDP - closing 134.102.218.18, port 5683

shamblett commented 3 years ago

OK, looks as though your initial problem of using an IP address is now OK, the above log shows you are closing the client then trying to use it again, after the first response you do this -

/flutter (23240): 2021-02-02 20:07:37.364: INFO: >> Matcher - cleaning up KeyID[23145])
I/flutter (23240): 2021-02-02 20:07:37.372: INFO: >> Reliability - Cancel retransmission for token: 00000c3e id: 23145
I/flutter (23240): 2021-02-02 20:07:37.406: INFO: >> Close - closing client
I/flutter (23240): 2021-02-02 20:07:37.408: INFO: >> Endpoint - stopping endpoint bound to InternetAddress('134.102.218.18', IPv4)
I/flutter (23240): 2021-02-02 20:07:37.410: INFO: >> Network UDP - closing 134.102.218.18, port 5683
I/flutter (23240): 2021-02-02 20:07:37.417: INFO: >> Stopping Mark-And-Sweep
I/flutter (23240): 2021-02-02 20:07:37.423: INFO: >> Matcher - Exchange completed: Cleaning up KeyToken[00000c3e]
I/flutter (23240): 2021-02-02 20:07:37.473: INFO: >> Network UDP - closing 134.102.218.18, port 5683

i.e. close the client, then you try and use it again, this is whats causing your error, if you have not finished with the client don't close it.

TerryLiu commented 3 years ago

OK, looks as though your initial problem of using an IP address is now OK, the above log shows you are closing the client then trying to use it again, after the first response you do this -

/flutter (23240): 2021-02-02 20:07:37.364: INFO: >> Matcher - cleaning up KeyID[23145])
I/flutter (23240): 2021-02-02 20:07:37.372: INFO: >> Reliability - Cancel retransmission for token: 00000c3e id: 23145
I/flutter (23240): 2021-02-02 20:07:37.406: INFO: >> Close - closing client
I/flutter (23240): 2021-02-02 20:07:37.408: INFO: >> Endpoint - stopping endpoint bound to InternetAddress('134.102.218.18', IPv4)
I/flutter (23240): 2021-02-02 20:07:37.410: INFO: >> Network UDP - closing 134.102.218.18, port 5683
I/flutter (23240): 2021-02-02 20:07:37.417: INFO: >> Stopping Mark-And-Sweep
I/flutter (23240): 2021-02-02 20:07:37.423: INFO: >> Matcher - Exchange completed: Cleaning up KeyToken[00000c3e]
I/flutter (23240): 2021-02-02 20:07:37.473: INFO: >> Network UDP - closing 134.102.218.18, port 5683

i.e. close the client, then you try and use it again, this is whats causing your error, if you have not finished with the client don't close it.

Thans you very very much! it works ok.

I added initState() and dispose() to your example/flutter/main.dar CoapClient client; @override void initState() { final Uri uri = Uri(scheme: 'coap',host:'124.71.151.247', port: 5688); // Client client = CoapClient(uri, config); } @override void dispose() { client.close(); }

But, the log SEVERE: >> Responding to ping by Instance of 'CoapInternetAddress' be generated per 0.5s Why is the huge log:

I/flutter (25021): 2021-02-02 22:10:25.111: INFO: >> CoapUtils:lookupHost host '124.71.151.247' is an IP address, not resolving I/flutter (25021): 2021-02-02 22:10:25.114: INFO: >> Reliability - Scheduling transmission for I/flutter (25021): <<< Request Message >>> I/flutter (25021): Type: 0, Code: GET, Id: 29289, Token: 00006b4b, I/flutter (25021): Options = I/flutter (25021): [ I/flutter (25021): If-Match : I/flutter (25021): Uri Host : Uri-Host: 124.71.151.247 I/flutter (25021): E-tags : I/flutter (25021): None I/flutter (25021): Uri Port : 5688 I/flutter (25021): Location Paths: I/flutter (25021): Uri Paths : hello I/flutter (25021): Content-Type : None I/flutter (25021): Max Age : None I/flutter (25021): Uri Queries : I/flutter (25021): Accept : None I/flutter (25021): Location Queries : I/flutter (25021): Proxy Uri : None I/flutter (25021): Proxy Scheme : None I/flutter (25021): Block 1 : None I/flutter (25021): Block 2 : None I/flutter (25021): Observe : -1 I/flutter (25021): Size 1 : 0 I/flutter (25021): Size 2 : 0 I/flutter (25021): ], I/flutter (25021): Payload : I/flutter (25021): null I/flutter (25021): 2021-02-02 22:10:25.114: INFO: >> Reliability - sending request, failed transmission count: 0 I/flutter (25021): 2021-02-02 22:10:25.115: INFO: >> Reliability - Retransmission timeout is 3951 ms I/flutter (25021): 2021-02-02 22:10:25.116: INFO: >> Matcher - Stored open request by KeyID[29289]) + KeyToken[00006b4b] I/flutter (25021): 2021-02-02 22:10:25.117: INFO: >> CoapNetworkUDP - binding to 0.0.0.0 D/libc-netbsd(25021): [getaddrinfo]: hostname=0.0.0.0; servname=(null); netid=0; mark=0 D/libc-netbsd(25021): [getaddrinfo]: ai_addrlen=0; ai_canonname=(null); ai_flags=1024; ai_family=0 I/flutter (25021): 2021-02-02 22:10:25.535: SEVERE: >> Responding to ping by Instance of 'CoapInternetAddress' I/flutter (25021): 2021-02-02 22:10:25.783: SEVERE: >> Responding to ping by Instance of 'CoapInternetAddress' I/flutter (25021): 2021-02-02 22:10:25.811: SEVERE: >> Responding to ping by Instance of 'CoapInternetAddress' I/flutter (25021): 2021-02-02 22:10:26.450: SEVERE: >> Responding to ping by Instance of 'CoapInternetAddress' I/flutter (25021): 2021-02-02 22:10:26.766: SEVERE: >> Responding to ping by Instance of 'CoapInternetAddress' I/flutter (25021): 2021-02-02 22:10:27.458: SEVERE: >> Responding to ping by Instance of 'CoapInternetAddress' I/flutter (25021): 2021-02-02 22:10:27.762: SEVERE: >> Responding to ping by Instance of 'CoapInternetAddress' I/flutter (25021): 2021-02-02 22:10:28.334: SEVERE: >> Responding to ping by Instance of 'CoapInternetAddress' I/flutter (25021): 2021-02-02 22:10:28.772: SEVERE: >> Responding to ping by Instance of 'CoapInternetAddress' I/flutter (25021): 2021-02-02 22:10:29.068: WARNING: >> Reliability - Retransmission timeout elapsed I/flutter (25021): 2021-02-02 22:10:29.068: WARNING: >> Reliability - Timeout: retransmit message, failed count: 1 message: 29289 I/flutter (25021): 2021-02-02 22:10:29.069: INFO: >> Reliability - Scheduling transmission for I/flutter (25021): <<< Request Message >>> I/flutter (25021): Type: 0, Code: GET, Id: 29289, Token: 00006b4b, I/flutter (25021): Options = I/flutter (25021): [ I/flutter (25021): If-Match : I/flutter (25021): Uri Host : Uri-Host: 124.71.151.247 I/flutter (25021): E-tags : I/flutter (25021): None I/flutter (25021): Uri Port : 5688 I/flutter (25021): Location Paths: I/flutter (25021): Uri Paths : hello I/flutter (25021): Content-Type : None I/flutter (25021): Max Age : None I/flutter (25021): Uri Queries : I/flutter (25021): Accept : None I/flutter (25021): Location Queries : I/flutter (25021): Proxy Uri : None I/flutter (25021): Proxy Scheme : None I/flutter (25021): Block 1 : None I/flutter (25021): Block 2 : None I/flutter (25021): Observe : -1 I/flutter (25021): Size 1 : 0 I/flutter (25021): Size 2 : 0 I/flutter (25021): ], I/flutter (25021): Payload : I/flutter (25021): null I/flutter (25021): 2021-02-02 22:10:29.070: INFO: >> Reliability - sending request, failed transmission count: 1 I/flutter (25021): 2021-02-02 22:10:29.071: INFO: >> Reliability - Retransmission timeout is 7902 ms I/flutter (25021): 2021-02-02 22:10:29.071: INFO: >> Matcher - Stored open request by KeyID[29289]) + KeyToken[00006b4b] I/flutter (25021): 2021-02-02 22:10:29.087: INFO: >> Matcher - received response I/flutter (25021): <<< Response Message >>> I/flutter (25021): Type: 0, Code: 2.05 Content, Id: 53665, Token: 00006b4b, I/flutter (25021): Options = I/flutter (25021): [ I/flutter (25021): If-Match : I/flutter (25021): Uri Host : None I/flutter (25021): E-tags : I/flutter (25021): None I/flutter (25021): Uri Port : None I/flutter (25021): Location Paths: I/flutter (25021): Uri Paths : I/flutter (25021): Content-Type : 0 I/flutter (25021): Max Age : None I/flutter (25021): Uri Queries : I/flutter (25021): Accept : -1 I/flutter (25021): Location Queries : I/flutter (25021): Proxy Uri : None I/flutter (25021): Proxy Scheme : None I/flutter (25021): Block 1 : None I/flutter (25021): Block 2 : None I/flutter (25021): Observe : -1 I/flutter (25021): Size 1 : 0 I/flutter (25021): Size 2 : 0 I/flutter (25021): ], I/flutter (25021): Payload : I/flutter (25021): Been running for 0s.Now is 2021-02-02 22:09:28.7364704 +0800 CST m=+7621.564261401 I/flutter (25021): 2021-02-02 22:10:29.088: INFO: >> Matcher - cleaning up KeyID[29289]) I/flutter (25021): 2021-02-02 22:10:29.089: INFO: >> Reliability - Cancel retransmission for token: 00006b4b id: 29289 I/flutter (25021): 2021-02-02 22:10:29.089: INFO: >> Reliability - Response is confirmable, send ACK. I/flutter (25021): 2021-02-02 22:10:29.091: INFO: >> Matcher - Exchange completed: Cleaning up KeyToken[00006b4b] I/flutter (25021): 2021-02-02 22:10:29.127: WARNING: >> Matcher - Ignoring unmatchable empty message from Instance of 'CoapInternetAddress' : I/flutter (25021): Type: 2, Code: Empty Message, Id: 29289, Token: 00, I/flutter (25021): Options = I/flutter (25021): [ I/flutter (25021): If-Match : I/flutter (25021): Uri Host : None I/flutter (25021): E-tags : I/flutter (25021): None I/flutter (25021): Uri Port : None I/flutter (25021): Location Paths: I/flutter (25021): Uri Paths : I/flutter (25021): Content-Type : None I/flutter (25021): Max Age : None I/flutter (25021): Uri Queries : I/flutter (25021): Accept : None I/flutter (25021): Location Queries : I/flutter (25021): Proxy Uri : None I/flutter (25021): Proxy Scheme : None I/flutter (25021): Block 1 : None I/flutter (25021): Block 2 : None I/flutter (25021): Observe : -1 I/flutter (25021): Size 1 : 0 I/flutter (25021): Size 2 : 0 I/flutter (25021): ], I/flutter (25021): Payload : I/flutter (25021): null I/flutter (25021): 2021-02-02 22:10:29.324: SEVERE: >> Responding to ping by Instance of 'CoapInternetAddress' I/flutter (25021): 2021-02-02 22:10:29.807: SEVERE: >> Responding to ping by Instance of 'CoapInternetAddress' I/flutter (25021): 2021-02-02 22:10:30.095: SEVERE: >> Responding to ping by Instance of 'CoapInternetAddress' I/flutter (25021): 2021-02-02 22:10:30.335: SEVERE: >> Responding to ping by Instance of 'CoapInternetAddress' I/flutter (25021): 2021-02-02 22:10:30.877: SEVERE: >> Responding to ping by Instance of 'CoapInternetAddress' I/flutter (25021): 2021-02-02 22:10:31.095: SEVERE: >> Responding to ping by Instance of 'CoapInternetAddress' I/flutter (25021): 2021-02-02 22:10:31.322: SEVERE: >> Responding to ping by Instance of 'CoapInternetAddress' I/flutter (25021): 2021-02-02 22:10:31.867: SEVERE: >> Responding to ping by Instance of 'CoapInternetAddress' I/flutter (25021): 2021-02-02 22:10:32.133: SEVERE: >> Responding to ping by Instance of 'CoapInternetAddress' I/flutter (25021): 2021-02-02 22:10:32.322: SEVERE: >> Responding to ping by Instance of 'CoapInternetAddress' I/flutter (25021): 2021-02-02 22:10:32.877: SEVERE: >> Responding to ping by Instance of 'CoapInternetAddress' I/flutter (25021): 2021-02-02 22:10:33.193: SEVERE: >> Responding to ping by Instance of 'CoapInternetAddress' I/flutter (25021): 2021-02-02 22:10:33.347: SEVERE: >> Responding to ping by Instance of 'CoapInternetAddress' I/flutter (25021): 2021-02-02 22:10:33.907: SEVERE: >> Responding to ping by Instance of 'CoapInternetAddress' I/flutter (25021): 2021-02-02 22:10:34.093: SEVERE: >> Responding to ping by Instance of 'CoapInternetAddress' I/flutter (25021): 2021-02-02 22:10:34.324: SEVERE: >> Responding to ping by Instance of 'CoapInternetAddress' I/flutter (25021): 2021-02-02 22:10:34.857: SEVERE: >> Responding to ping by Instance of 'CoapInternetAddress' I/flutter (25021): 2021-02-02 22:10:35.057: INFO: >> Start Mark-And-Sweep with 1 entries I/flutter (25021): 2021-02-02 22:10:35.058: INFO: >> Mark-And-Sweep removes KeyID[53665]) I/flutter (25021): 2021-02-02 22:10:35.089: SEVERE: >> Responding to ping by Instance of 'CoapInternetAddress' I/flutter (25021): 2021-02-02 22:10:35.323: SEVERE: >> Responding to ping by Instance of 'CoapInternetAddress' I/flutter (25021): 2021-02-02 22:10:35.857: SEVERE: >> Responding to ping by Instance of 'CoapInternetAddress' I/flutter (25021): 2021-02-02 22:10:36.092: SEVERE: >> Responding to ping by Instance of 'CoapInternetAddress' I/flutter (25021): 2021-02-02 22:10:36.323: SEVERE: >> Responding to ping by Instance of 'CoapInternetAddress' I/flutter (25021): 2021-02-02 22:10:36.887: SEVERE: >> Responding to ping by Instance of 'CoapInternetAddress' I/flutter (25021): 2021-02-02 22:10:37.090: SEVERE: >> Responding to ping by Instance of 'CoapInternetAddress' I/flutter (25021): 2021-02-02 22:10:37.323: SEVERE: >> Responding to ping by Instance of 'CoapInternetAddress' I/flutter (25021): 2021-02-02 22:10:37.897: SEVERE: >> Responding to ping by Instance of 'CoapInternetAddress' I/flutter (25021): 2021-02-02 22:10:38.091: SEVERE: >> Responding to ping by Instance of 'CoapInternetAddress' I/flutter (25021): 2021-02-02 22:10:38.326: SEVERE: >> Responding to ping by Instance of 'CoapInternetAddress' I/flutter (25021): 2021-02-02 22:10:38.847: SEVERE: >> Responding to ping by Instance of 'CoapInternetAddress' I/flutter (25021): 2021-02-02 22:10:39.090: SEVERE: >> Responding to ping by Instance of 'CoapInternetAddress' I/flutter (25021): 2021-02-02 22:10:39.321: SEVERE: >> Responding to ping by Instance of 'CoapInternetAddress' I/flutter (25021): 2021-02-02 22:10:39.845: SEVERE: >> Responding to ping by Instance of 'CoapInternetAddress' I/flutter (25021): 2021-02-02 22:10:40.090: SEVERE: >> Responding to ping by Instance of 'CoapInternetAddress' I/flutter (25021): 2021-02-02 22:10:40.337: SEVERE: >> Responding to ping by Instance of 'CoapInternetAddress' I/flutter (25021): 2021-02-02 22:10:40.867: SEVERE: >> Responding to ping by Instance of 'CoapInternetAddress' I/flutter (25021): 2021-02-02 22:10:41.110: SEVERE: >> Responding to ping by Instance of 'CoapInternetAddress' I/flutter (25021): 2021-02-02 22:10:41.349: SEVERE: >> Responding to ping by Instance of 'CoapInternetAddress' I/flutter (25021): 2021-02-02 22:10:41.887: SEVERE: >> Responding to ping by Instance of 'CoapInternetAddress' I/flutter (25021): 2021-02-02 22:10:42.116: SEVERE: >> Responding to ping by Instance of 'CoapInternetAddress' I/flutter (25021): 2021-02-02 22:10:42.349: SEVERE: >> Responding to ping by Instance of 'CoapInternetAddress' I/flutter (25021): 2021-02-02 22:10:42.917: SEVERE: >> Responding to ping by Instance of 'CoapInternetAddress' I/flutter (25021): 2021-02-02 22:10:43.099: SEVERE: >> Responding to ping by Instance of 'CoapInternetAddress' I/flutter (25021): 2021-02-02 22:10:43.321: SEVERE: >> Responding to ping by Instance of 'CoapInternetAddress' I/flutter (25021): 2021-02-02 22:10:43.885: SEVERE: >> Responding to ping by Instance of 'CoapInternetAddress' I/flutter (25021): 2021-02-02 22:10:44.088: SEVERE: >> Responding to ping by Instance of 'CoapInternetAddress' I/flutter (25021): 2021-02-02 22:10:44.326: SEVERE: >> Responding to ping by Instance of 'CoapInternetAddress' I/flutter (25021): 2021-02-02 22:10:44.867: SEVERE: >> Responding to ping by Instance of 'CoapInternetAddress' I/flutter (25021): 2021-02-02 22:10:45.056: INFO: >> Start Mark-And-Sweep with 0 entries I/flutter (25021): 2021-02-02 22:10:45.087: SEVERE: >> Responding to ping by Instance of 'CoapInternetAddress' I/flutter (25021): 2021-02-02 22:10:45.325: SEVERE: >> Responding to ping by Instance of 'CoapInternetAddress' I/flutter (25021): 2021-02-02 22:10:45.887: SEVERE: >> Responding to ping by Instance of 'CoapInternetAddress' I/flutter (25021): 2021-02-02 22:10:46.088: SEVERE: >> Responding to ping by Instance of 'CoapInternetAddress' I/flutter (25021): 2021-02-02 22:10:46.355: SEVERE: >> Responding to ping by Instance of 'CoapInternetAddress' I/flutter (25021): 2021-02-02 22:10:46.865: SEVERE: >> Responding to ping by Instance of 'CoapInternetAddress' I/flutter (25021): 2021-02-02 22:10:47.109: SEVERE: >> Responding to ping by Instance of 'CoapInternetAddress' I/flutter (25021): 2021-02-02 22:10:47.320: SEVERE: >> Responding to ping by Instance of 'CoapInternetAddress' I/flutter (25021): 2021-02-02 22:10:47.759: SEVERE: >> Responding to ping by Instance of 'CoapInternetAddress' I/flutter (25021): 2021-02-02 22:10:48.265: SEVERE: >> Responding to ping by Instance of 'CoapInternetAddress' I/flutter (25021): 2021-02-02 22:10:48.321: SEVERE: >> Responding to ping by Instance of 'CoapInternetAddress' I/flutter (25021): 2021-02-02 22:10:48.808: SEVERE: >> Responding to ping by Instance of 'CoapInternetAddress' I/flutter (25021): 2021-02-02 22:10:49.235: SEVERE: >> Responding to ping by Instance of 'CoapInternetAddress' I/flutter (25021): 2021-02-02 22:10:49.334: SEVERE: >> Responding to ping by Instance of 'CoapInternetAddress' I/flutter (25021): 2021-02-02 22:10:49.875: SEVERE: >> Responding to ping by Instance of 'CoapInternetAddress' I/flutter (25021): 2021-02-02 22:10:50.091: SEVERE: >> Responding to ping by Instance of 'CoapInternetAddress' I/flutter (25021): 2021-02-02 22:10:50.796: SEVERE: >> Responding to ping by Instance of 'CoapInternetAddress' I/flutter (25021): 2021-02-02 22:10:51.089: SEVERE: >> Responding to ping by Instance of 'CoapInternetAddress' I/flutter (25021): 2021-02-02 22:10:51.828: SEVERE: >> Responding to ping by Instance of 'CoapInternetAddress' I/flutter (25021): 2021-02-02 22:10:52.088: SEVERE: >> Responding to ping by Instance of 'CoapInternetAddress' I/flutter (25021): 2021-02-02 22:10:52.856: SEVERE: >> Responding to ping by Instance of 'CoapInternetAddress' I/flutter (25021): 2021-02-02 22:10:53.089: SEVERE: >> Responding to ping by Instance of 'CoapInternetAddress' I/flutter (25021): 2021-02-02 22:10:53.331: SEVERE: >> Responding to ping by Instance of 'CoapInternetAddress' I/flutter (25021): 2021-02-02 22:10:53.352: SEVERE: >> Responding to ping by Instance of 'CoapInternetAddress' I/flutter (25021): 2021-02-02 22:10:53.878: SEVERE: >> Responding to ping by Instance of 'CoapInternetAddress' I/flutter (25021): 2021-02-02 22:10:54.108: SEVERE: >> Responding to ping by Instance of 'CoapInternetAddress' I/flutter (25021): 2021-02-02 22:10:54.324: SEVERE: >> Responding to ping by Instance of 'CoapInternetAddress' I/flutter (25021): 2021-02-02 22:10:54.907: SEVERE: >> Responding to ping by Instance of 'CoapInternetAddress' I/flutter (25021): 2021-02-02 22:10:55.060: INFO: >> Start Mark-And-Sweep with 0 entries I/flutter (25021): 2021-02-02 22:10:55.098: SEVERE: >> Responding to ping by Instance of 'CoapInternetAddress' I/flutter (25021): 2021-02-02 22:10:55.323: SEVERE: >> Responding to ping by Instance of 'CoapInternetAddress' I/flutter (25021): 2021-02-02 22:10:55.817: SEVERE: >> Responding to ping by Instance of 'CoapInternetAddress' I/flutter (25021): 2021-02-02 22:10:56.090: SEVERE: >> Responding to ping by Instance of 'CoapInternetAddress' I/flutter (25021): 2021-02-02 22:10:56.325: SEVERE: >> Responding to ping by Instance of 'CoapInternetAddress' I/flutter (25021): 2021-02-02 22:10:56.847: SEVERE: >> Responding to ping by Instance of 'CoapInternetAddress' I/flutter (25021): 2021-02-02 22:10:57.088: SEVERE: >> Responding to ping by Instance of 'CoapInternetAddress' I/flutter (25021): 2021-02-02 22:10:57.323: SEVERE: >> Responding to ping by Instance of 'CoapInternetAddress' I/flutter (25021): 2021-02-02 22:10:57.877: SEVERE: >> Responding to ping by Instance of 'CoapInternetAddress' I/flutter (25021): 2021-02-02 22:10:58.089: SEVERE: >> Responding to ping by Instance of 'CoapInternetAddress' I/flutter (25021): 2021-02-02 22:10:58.324: SEVERE: >> Responding to ping by Instance of 'CoapInternetAddress' I/flutter (25021): 2021-02-02 22:10:58.897: SEVERE: >> Responding to ping by Instance of 'CoapInternetAddress' I/flutter (25021): 2021-02-02 22:10:59.088: SEVERE: >> Responding to ping by Instance of 'CoapInternetAddress' I/flutter (25021): 2021-02-02 22:10:59.335: SEVERE: >> Responding to ping by Instance of 'CoapInternetAddress' I/flutter (25021): 2021-02-02 22:10:59.817: SEVERE: >> Responding to ping by Instance of 'CoapInternetAddress' I/flutter (25021): 2021-02-02 22:11:00.087: SEVERE: >> Responding to ping by Instance of 'CoapInternetAddress' I/flutter (25021): 2021-02-02 22:11:00.326: SEVERE: >> Responding to ping by Instance of 'CoapInternetAddress' I/flutter (25021): 2021-02-02 22:11:00.768: SEVERE: >> Responding to ping by Instance of 'CoapInternetAddress' I/flutter (25021): 2021-02-02 22:11:01.191: SEVERE: >> Responding to ping by Instance of 'CoapInternetAddress' I/flutter (25021): 2021-02-02 22:11:01.326: SEVERE: >> Responding to ping by Instance of 'CoapInternetAddress' I/flutter (25021): 2021-02-02 22:11:01.887: SEVERE: >> Responding to ping by Instance of 'CoapInternetAddress' I/flutter (25021): 2021-02-02 22:11:02.139: SEVERE: >> Responding to ping by Instance of 'CoapInternetAddress' I/flutter (25021): 2021-02-02 22:11:02.323: SEVERE: >> Responding to ping by Instance of 'CoapInternetAddress' I/flutter (25021): 2021-02-02 22:11:02.877: SEVERE: >> Responding to ping by Instance of 'CoapInternetAddress' I/flutter (25021): 2021-02-02 22:11:03.095: SEVERE: >> Responding to ping by Instance of 'CoapInternetAddress' I/flutter (25021): 2021-02-02 22:11:03.324: SEVERE: >> Responding to ping by Instance of 'CoapInternetAddress' I/flutter (25021): 2021-02-02 22:11:03.827: SEVERE: >> Responding to ping by Instance of 'CoapInternetAddress' I/flutter (25021): 2021-02-02 22:11:04.091: SEVERE: >> Responding to ping by Instance of 'CoapInternetAddress' I/flutter (25021): 2021-02-02 22:11:04.324: SEVERE: >> Responding to ping by Instance of 'CoapInternetAddress' I/flutter (25021): 2021-02-02 22:11:04.821: SEVERE: >> Responding to ping by Instance of 'CoapInternetAddress'

shamblett commented 3 years ago

Looks as though your server is sending pings, also you have this -

I/flutter (25021): Type: 2, Code: Empty Message, Id: 29289, Token: 00,

Empty messages can be used as ping requests.

Which coap server are you using?

TerryLiu commented 3 years ago

Looks as though your server is sending pings, also you have this -

I/flutter (25021): Type: 2, Code: Empty Message, Id: 29289, Token: 00,

Empty messages can be used as ping requests.

Which coap server are you using?

The coap server is a demo I made. I understanding your means. Thanks very much again. the issues I close it.