-
Notifications
You must be signed in to change notification settings - Fork 15
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
M-SEARCH timeout #35
Comments
🏁 I have pushed it to master. One thing I am not certain about, though, the version I put in the end of the string is 1 and according to the pdf this means the max version supported. So I tried placing 2 there and it did not work. What do you suggest here? |
This is an interesting question that I had not considered. As for the question (O.T. it would be very complicated if the answer was only "42" - The Hitchhiker's Guide to the Galaxy) I read and searched in the forums and for what I could find the solutions do too many steps. In my opinion the goal is to keep TinyUPnP as light as possible, the esp8266 has a very limited memory compared to a linux server. So I propose two alternatives, both work for me.
|
Hi , i want to make a note about the M-SEARCH timeout, In my router (ZXHN H268N) the M-SEARCH timeout problem was the normal and very few times the library actually succeded to receive a response from the router. After a lot of testing i found the cause. I dont know if this is specific to my router or is a general problem , but the library is sending the UDP packet with a call to _udpClient.beginMulticast(WiFi.localIP(), ipMulti, UPNP_SSDP_PORT) ] and the UPNP_SSDP_PORT is defined as 1900. This is the same port as the destination port. When the ports are the same e.g. source port 1900 and destination port 1900, my router does not send a response ( or the NodeMcu does not proccess the packet ) and the success rate (to succesfully recieve the notify message) is 1 to 20 or 30. To solve the problem i changed the code to [_udpClient.beginMulticast(WiFi.localIP(), ipMulti, 0)]. |
Hey @xaos3, I think you're right, the method you changed is simply changing the source port, and even though I could not find a justification to the randomization in the documentation, I think this is true and it actually randomizes a port larger than 1024. Took me a while to find the place where I enforce the destination port since I did not use the constant for the port. Here it is https://github.com/ofekp/TinyUPnP/blob/master/src/TinyUPnP.cpp#L523 This is a great find. Thank you for that. Would you be willing to create the PR? If you prefer, I can take this. |
I'm very glad that i was able to help even a little! |
I am so glad you did that. I think helping others is what we're here for :) NP, I will make the PR. Keep it up! |
FYI, relevant PR #49 |
Yes, i test it on my network , the responce was fast and consistent! 😃 |
Perfect! Thank you! Will merge the PR. |
Sometimes timeout can occur before InternetGatewayDevice detection, especially in networks with many UPnP devices
To solve the issue and make communication with the right device more efficient I propose to change the M-SEARCH Search Target (ST) by replacing
strcat_P(body_tmp, PSTR("ST: ssdp:all\r\n\r\n"));
with
strcat_P(body_tmp, PSTR("ST: urn:schemas-upnp-org:device:InternetGatewayDevice:1\r\n"));
as specified in http://upnp.org/specs/arch/UPnP-arch-DeviceArchitecture-v1.1.pdf (PDF pag38 ~ printed pag31)
The text was updated successfully, but these errors were encountered: