Comments (5)
Hi @kevinelliott, thanks for using udp!
Version 3.0.0 introduces an optional duration parameter for udp.listen(). So now it's possible to listen indefinitely.
To stop listening, please call udp.close() on the udp instance.
from udp.
Hi @xenoken ... thank you for the library!
Upon removal of the duration, my application exits immediately and does not receive any UDP packets. I'm assuming now I need some kind of main state loop with sleeps in order to prevent the application from exiting?
from udp.
That's correct @kevinelliott.
When timeout is specified, udp.listen() returns a future that completes only after the time has run out. When timeout is not specified, udp.listen() returns a future that is already completed (with value true). In the latter case listen() behaves like a synchronous function call that returns immediately.
from udp.
Ahh, I see... what I was looking for was a never ending listen... I need to process millions of UDP packets over time.
from udp.
Yes, udp.listen() is indeed never ending. It will keep listening for packets even though the function returns immediately. for example:
var receiver = await UDP.bind(Endpoint.loopback(port: Port(54321));
var success = await receiver.listen((datagram){
// ...your callback code here...
});
// even though the execution reaches this point, receiver is still listening to udp packets.
// what is required now is a way to prevent the application from exiting.
// ...end of program here...
from udp.
Related Issues (20)
- Add support for null safety. HOT 5
- Not able to work with udp on iOS when I run app from xCode HOT 5
- [Flutter] [Android] OS Error errno = 1 or 13 when binding in release mode HOT 1
- Web udp. HOT 1
- bind multicast Failed windows HOT 4
- Android receive udp broadcast from other device but fails sending its own broadcast
- Issue since upgraging with .listen
- HandleUncaughtErrorHandler error:OS Error: Bad file descriptor, errno = 9
- SocketException: Failed to create datagram socket (OS Error: Cannot assign requested address, errno = 99), address = 146.59.158.195, port = 6001 HOT 2
- Can receive broadcast messages ? HOT 1
- nulticast
- Receiving broadcast on Android HOT 3
- Fatal Exception: FlutterError _RawDatagramSocket.broadcastEnabled= (dart:io)
- Subnet broadcast is not possible
- Example doesnt work HOT 1
- mutiple requests not work
- I can't reveive data from server -iPhone HOT 2
- StreamBuilder integration? HOT 2
- Hardware communication HOT 1
- Can send, but can't receive packets on Android 11 HOT 8
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from udp.