Closed kwekel closed 2 years ago
I can't see any reason why this wouldn't work, unless its because its the same host but even so, I'll have a look at this.
I can't see any reason why this wouldn't work, unless its because its the same host but even so, I'll have a look at this.
Eventbus is the main reason, I can’t find a way to reset it, only destroy method, and it is Singleton, so I used stream instead of it.
Do you mean you got rid of event bus entirely and used your own solution?
When you have multiple clients, EventBus can’t knowe which one to deliver, it will notify all, and then I can't find a way to unsubscribe EventBus when Client closed, so I use Stream for CoapDataReceivedEvent & CoapCompletedEvent, it is work.
Yes your right, I thought I'd addressed this a while ago, clearly not, I'll look at it again, thanks.
Ironically, #40 should also fix this
Hi, I'm trying to ping different servers using the CoAP package in my Flutter app. The first one works and returns true. The second however gives back an error. In this example I've used the same host, but in the real app I would of course use a different host. The reason I would like to ping different hosts is because I want to discover hardware on my local network by pinging different hosts.
This is the error in the console:
[VERBOSE-2:ui_dart_state.cc(199)] Unhandled Exception: RangeError: Index out of range: no indices are valid: 0
0 TypedDataBuffer.[] (package:typed_data/src/typed_buffer.dart:32:26)
1 ListMixin.removeAt (dart:collection/list.dart:538:20)
2 CoapDatagramReader._readCurrentByte (package:coap/src/codec/datagram/coap_datagram_reader.dart:81:26)
3 CoapDatagramReader.read (package:coap/src/codec/datagram/coap_datagram_reader.dart:34:9)
4 CoapMessageDecoder18.readProtocol (package:coap/src/codec/decoders/coap_message_decoder18.dart:23:25)
5 new CoapMessageDecoder18 (package:coap/src/codec/decoders/coap_message_decoder18.dart:14:5)
6 CoapDraft18.newMessageDecoder (package:coap/src/specification/drafts/coap_draft18.dart:52:7)
7 CoapEndPoint._receiveData (package:coap/src/net/coap_endpoint.dart:96:35)
8 _rootRunUnary (dart:async/zone.dart:1362:47)
9 _CustomZone.runUnary (dart:async/zone.dart:1265:19)
10 _CustomZone.runUnaryGuarded (dart:async/zone.dart:1170:7)
11 CastStreamSubscription._onData (dart:_internal/async_cast.dart:85:11)
12 _rootRunUnary (dart:async/zone.dart:1362:47)
13 _CustomZone.runUnary (dart:async/zone.dart:1265:19)
14 _CustomZone.runUnaryGuarded (dart:async/zone.dart:1170:7)
15 _BufferingStreamSubscription._sendData (dart:async/stream_impl.dart:341:11)
16 _BufferingStreamSubscription._add (dart:async/stream_impl.dart:271:7)
17 _ForwardingStreamSubscription._add (dart:async/stream_pipe.dart:123:11)
18 _WhereStream._handleData (dart:async/stream_pipe.dart:195:12)
19 _ForwardingStreamSubscription._handleData (dart:async/stream_pipe.dart:153:13)
20 _rootRunUnary (dart:async/zone.dart:1362:47)
21 _CustomZone.runUnary (dart:async/zone.dart:1265:19)
22 _CustomZone.runUnaryGuarded (dart:async/zone.dart:1170:7)
23 _BufferingStreamSubscription._sendData (dart:async/stream_impl.dart:341:11)
24 _DelayedData.perform (dart:async/stream_impl.dart:591:14)
25 _StreamImplEvents.handleNext (dart:async/stream_impl.dart:706:11)
26 _PendingEvents.schedule. (dart:async/stream_impl.dart:663:7)
27 _rootRun (dart:async/zone.dart:1346:47)
28 _CustomZone.run (dart:async/zone.dart:1258:19)
29 _CustomZone.runGuarded (dart:async/zone.dart:1162:7)
30 _CustomZone.bindCallbackGuarded. (dart:async/zone.dart:1202:23)
31 _rootRun (dart:async/zone.dart:1354:13)
32 _CustomZone.run (dart:async/zone.dart:1258:19)
33 _CustomZone.runGuarded (dart:async/zone.dart:1162:7)
34 _CustomZone.bindCallbackGuarded. (dart:async/zone.dart:1202:23)
35 _microtaskLoop (dart:async/schedule_microtask.dart:40:21)
36 _startMicrotaskLoop (dart:async/schedule_microtask.dart:49:5)
Am I doing something wrong? Or is it not possible to ping different hosts?