Comments (3)
Hey there, currently there is no support for that.
The reason is that with the current API you will have to listen constantly to the UDP packets each time checking the size and and if > 0 you check if it is a NOTIFY packet.
Instead we will need to use something like this:
https://github.com/espressif/arduino-esp32/tree/master/libraries/AsyncUDP
which will work with interrupts.
I believe it will be a good idea to implement this since this will be good for both M-SEARCH and NOTIFY, but a thought needs to be given on what happens if there are too many NOTIFY messages, that might congest the device. If it is running a server, it might slow it down in extreme situations, so there should be a flag to disable it.
This will require some work, not seeing that I can get to it soon, if you can start a PR I can join and help as best I can. The link I provided is a good start.
from tinyupnp.
Okay, so you mean that the _udpclient object does not give NOTIFY packets as a response when we call int packetSize = _udpClient.parsePacket(); is that right?
not exactly, what I mean is that you would have to constantly listen to NOTIFY messages which is not feasible if you also have a server running on the same core. The async package should take care of this in the sense that you can be interrupting the server thread when NOTIFY messages are available. I think the link I shared is a package that will allow that. _udpclient can pick up NOTIFY messages but it will need to have a thread that is constantly active and checking if there are new packets. I think we can still make it work with _udpclient if we add a periodic check in the main loop but perhaps the interrupt will be better, since it will only interrupt the main loop if there are actually NOTIFY packets. Does that make sense? I hope I explained it well.
from tinyupnp.
Okay, so you mean that the _udpclient
object does not give NOTIFY packets as a response when we call int packetSize = _udpClient.parsePacket();
is that right?
If so the link you shared is definitely a good start in order to implement this. I have tried using async calls before in my program and not a big fan of them as they might trigger watchdog timeouts. However, I will try implementing this and get back.
In the case where we get too many NOTIFY messages, we can use a cyclic buffer which will avoid stack overflows. I think that will be a good start. And yes, a flag to disable the service is also needed.
Thanks for the reply and guidance.
from tinyupnp.
Related Issues (20)
- ESP-IDF Support HOT 9
- TinyUPNP library makes my esp8266 crash and reset HOT 18
- How to configure diferent internal and external port? HOT 8
- Gateway info is not valid HOT 98
- Stack overflow while reading xml HOT 4
- Use WiFi Library Events
- Option for both local and external port (with code) HOT 3
- Gateway info is not valid HOT 3
- Invalid router info HOT 10
- Implementation for knowing what all services are present on the network HOT 12
- ERROR: Invalid router info, cannot continue HOT 3
- Timeout expired while waiting for the gateway router to respond to M-SEARCH message HOT 9
- ESP32 arduino with Ethernet. HOT 19
- UPnP Errors 714 and 718 HOT 6
- TCP timeout while retrieving port mappings (ERROR: While updating UPnP port mapping. Failed with error code [5]) HOT 2
- Device is not discovered by UPnP Browser app. HOT 2
- Add an option to provide the description XML file to make setting the rules faster
- Error in UPnP ver. 3.1.4 HOT 6
- Esp32cam UPnP and EasyDDNS to No-Ip no connection HOT 1
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 tinyupnp.