-
Notifications
You must be signed in to change notification settings - Fork 9
SocketTimeoutExceptions and log statements #11
Comments
|
@wnemay Where does this trick go to? In the current implementation, in resolve() and discover() methods in So setting the Port Number resolves the issue ? If it's is there any specific PORT Number to set ? Thanks. |
I figured out how to initialise the I've a weird behavior though, I guess it would be the reason for these exceptions. Whenever I start the discovery, my Wifi Connection drops and the device connects back to LTE network (I've Nexus 6P). So it finds the devices in my sub network but when trying to make a socket connection to retrieve the TXT Records, it fails and drops the Wifi Connection, so it fails with SocketTimeOutException. I've used this library in a Beta version where I can send the build to test users and get some feedback, and I get the same logs from them. They all share the same failure. Any idea what is going on ? @wnemay @ryanidev @youview-android-team Thanks, |
I get the same issue. However, it happens only with services advertised by Avahi on Linux only. It works well with for services advertised with command line dns-sd -P (from Bonjour for Windows package). |
I think I found the source of the exception. In MDNSDiscover.resolve(), we try to get A record, which is not sent by Avahi, thus the condition result.a == null in the while loop is not satisfied and then we continue to receive() on the socket, which eventually causes the timeout. |
I am currently getting this issue. @huycn were you able to resolve it with the A record? Can we address this and submit a merge request, or is it as simple as adding an A record in Avahi? |
@kylemallory For my project, I ended up by modify the method MDNSDiscover.resolve() to remove result.a == null from the loop's condition, so it becomes: By looking at the method, it seems that it does the right thing: it asks for A record among other things, thus it's legitimate to expect for it. The reason why Avahi don't sent it is out of my knowledge. |
Thanks @huycn. I'll dig into it more. I am creating the Avahi messages on the service side; maybe I can find a way to include the A records explicitly. If not, I guess I can fork... |
Will this ever be solved? What would be the solution? I now altered the code myself but I don't really know if I'm doing the right thing because I don't have lowlevel knowledge about mDNS. I catched the SocketTimeoutException around the while loop and in the finaly part I still return the result even if it does not has a or srv data. If you run the (crappy) NSdChat app example from Google and register its service and listen to it with another device using this library the a and the srv are not filled. If you could make it work with this example the library would be fixed I guess..
Update: |
While it's not crashing, I'm seeing SocketTimeoutExceptions all over the place when scanning.
Also, there doesn't seem to be a way to shut off log statements. These are great when debugging, but in a production app, I'd rather it not print any log statements (or perhaps JUST critical errors).
The text was updated successfully, but these errors were encountered: