Comments (12)
Couldn't upload a diff file directly so here is a text file which you can change the extension of:
ChangesForAllDevices.txt
from tinyupnp.
This is probably what you'll have to change, I am only looking for IGD devices
https://github.com/ofekp/TinyUPnP/blob/master/src/TinyUPnP.cpp#L529
You can consult with a branch I currently have but not merged to understand how to fire multiple M-SEARCH queries or you can use a wide deviceType with a single M-SEARCH query (all). Note that it is better to narrow it as much as you can. You can narrow based on the response you get from the device which should include the correct deviceType.
from tinyupnp.
Thank you very much for your quick reply :D
I did try that branch as you have suggested. I am using the SSDP example from the Arudino SDK for ESP8266 which registers a device on the network as a Philips Hue Clone. I am able to see that device as well as another device on in the Networks folder on Windows 10. However, I am unable to find them in the debug logs.
Given how the branch is not yet merged, is this feature still a work in progress? I am looking to implement a SSDP listener so I can get a list of any devices on the network. If I can understand what you have suggested correctly, I can fire a single M-SEARCH query for all devices and it will list down whatever devices are on the network?
from tinyupnp.
Instead of using the branch (I am not sure I will ever merge that), can you try changing the line
https://github.com/ofekp/TinyUPnP/blob/master/src/TinyUPnP.cpp#L529
to
strcat_P(body_tmp, PSTR("ST: ssdp:all\r\n\r\n"));
from tinyupnp.
Thanks for your continued guidance and assistance!
Okay, I have tried what you suggested. I have also removed the return false
which stops the program from proceeding if any device other than an Internet Gateway Device is found.
However, despite this I am only able to see communication between the device and the Router. At the end I get the message saying that all ports and devices were discovered without my device ever showing up. For additional reference, my device has the following property:
SSDP.setDeviceType("upnp:rootdevice");
Are there any additional changes that would be required to show such types of devices?
from tinyupnp.
Okay, I have tried what you suggested. I have also removed the return false which stops the program from proceeding if any device other than an Internet Gateway Device is found.
Nice, I actually forgot about that one :)
Can you try to replace the same line with this:
strcat_P(body_tmp, PSTR("ST: upnp:rootdevice\r\n\r\n"));
Please also make sure you are running the code you intend to run. You can add a compilation error on purpose and compile to see if your changes are actually being used.
By seeing communication with the router, you mean you can see in the debug logs the response to the M-SEARCH message which contains, among other headers, the Location header, is this correct?
For the device you are setting up with
SSDP.setDeviceType("upnp:rootdevice");
Is it listening on port 1900 UDP?
Do you have access to a linux machine? Can you use something like this maybe? to see if the device responds?
I have not tried it myself, if you find a better way to check for all upnp devices in your network please let me know what you found.
from tinyupnp.
Do you have access to a linux machine? Can you use something like this maybe? to see if the device responds?
Through gssdp
, I am able to see all the devices in my network on Linux. I can also selectively target specific device types to show only the ones that I need.
For the device you are setting up with
SSDP.setDeviceType("upnp:rootdevice");
Is it listening on port 1900 UDP?
Yes, it is listening on port 1900
I have not tried it myself, if you find a better way to check for all upnp devices in your network please let me know what you found.
I think the tutorial you linked for gssdp is the best way to discover all devices, thanks a lot for the help :)
from tinyupnp.
I would like to understand if you were able to find the device using TinyUPnP, if so what did you do.
If you no longer need it, can I close the issue?
BTW, I found that there are two places where I filter based on the assumption that I the response should be received from an IGD device, did you remove both of them when trying the package?
- waitForUnicastResponseToMSearch -
if (remoteIP != gatewayIP) {
- waitForUnicastResponseToMSearch -
if (strstr(responseBuffer, INTERNET_GATEWAY_DEVICE) == NULL) {
from tinyupnp.
Hey ofekp, I really appreciate your quick responses and all the help which you have provided to me. I wasn't able to reply in the past few days due to some work issues.
If you no longer need it, can I close the issue?
Yes, I would like for you to close the issue, I have found the solution to my problem.
BTW, I found that there are two places where I filter based on the assumption that I the response should be received from an IGD device, did you remove both of them when trying the package?
waitForUnicastResponseToMSearch - if (remoteIP != gatewayIP) {
waitForUnicastResponseToMSearch - if (strstr(responseBuffer, INTERNET_GATEWAY_DEVICE) == NULL) {
Yes, I did remove both of these as well as what we had previously discussed in order to make sure all the devices were visible. It works like a charm now :)
I would like to understand if you were able to find the device using TinyUPnP, if so what did you do.
If you would like to see exactly the parts that I changed, I can make a pull request which you can leave as it is or I can send you a diff file with my changes.
from tinyupnp.
Awesome, I am happy it worked :) and NP
I would love to see what you change for the purpose of being able to help in the future, I might also incorporate this into the code with a flag or simply reference to this change from the README should someone need this in the future. So, yeah, if you can please share either a diff or a PR 👍
Thank you.
from tinyupnp.
Beautiful, thank you :) I will find a way to make it available for others in the README or via a flag 👍
Closing this for now.
from tinyupnp.
FYI, I just pushed this PR which gives a dedicated method to list all SSDP devices based on on the diff you provided (but as a function).
I also provided an example to show how to use it.
Thank you.
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
- ERROR: Invalid router info, cannot continue HOT 3
- Cannot detect NOTIFY packets 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.