Skip to content
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

Server not working over tethering network #1

Open
occasionaldevshare opened this issue May 8, 2018 · 3 comments
Open

Server not working over tethering network #1

occasionaldevshare opened this issue May 8, 2018 · 3 comments
Assignees
Labels
bug Something isn't working

Comments

@occasionaldevshare
Copy link
Owner

Steps to reproduce

  1. Activate tethering on the device 1 (android device on which DroidUpnp will be running)
  2. Run DroidUpnp, and activate directory service (via settings menu of DroidUPnP)
  3. Connect another device (device 2) to the wifi network created by device 1 (android device which is running DroidUpnp)
  4. Run a UPnP client application on device 2.

Expected result

All media shared by device 1 can be played on device 2, by client application.

Current result

No media shared by device 1 can be played on device 2.

@occasionaldevshare occasionaldevshare added the bug Something isn't working label May 8, 2018
@occasionaldevshare occasionaldevshare self-assigned this May 8, 2018
@occasionaldevshare
Copy link
Owner Author

occasionaldevshare commented May 8, 2018

Capturing the network streams allowed to spot that the URLs sent by device 1 are wrong (http://0.0.0.0:1234/a-5678.mp3 for example). Host is 0.0.0.0
Manually asking the player on device 2 to play a correct url (http://192.168.43.1:1234/a-5678.mp3 for example, when adress of device 1 is 192.168.43.1) works fine: media is played on device 2. However, for each item of device 1 shown within client application on device 2, one has to check the information (right-click etc) of the item, then guess the correct url (mainly replacing the host within the url) and to add the correct url to the playlist. Adding, via client application on device 2, the whole content of device 1 (discovered by device 2) will not work because all urls are wrong.
After spotting the code which "guesses" the adress (to which the server must be bound), I found many discussions (StackExchange.com, etc) of other application developers meeting the same kind of issue, stating that most attempts will fail for tethering interfaces. Neither WifiManager nor getting the IPv4 adress of interface named wlan0 will work. The only way to get the IP adress (for the tethering interface on Android) seems to be to get the gateway adress.
I will try (when all other attempts failed) to get the gateway adress of the unique tethering interface (if any). To check whether tethering is enabled:

  • either I will use "isWifiApEnabled", then check gateway adress of wlan0 interface,
  • either I will use getTetheringInterfaces and check that the returned collection contains only one interface (wlan0 or usb0 or whatever), and check the gateway adress of this interface.

The second proposal seems more generic, I will try it first and in case it works, implementing proposal #1 will not be needed.

@occasionaldevshare
Copy link
Owner Author

@occasionaldevshare
Copy link
Owner Author

Through the emulator, running API level 15, all the above methods (see gist above) could be called (even though no meaningful value was returned, due to limitations of the emulator, not allowing to emulate a wifi network).
When I will have time, I will try on a real device to check that correction works.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant