Jump to content

Server Discovery when running in Emulator


kingargyle

Recommended Posts

kingargyle

I've managed to get the ServerLocator API to work when running on an actual device, however, everytime I run in an Android TV Emulator, it never finds the Server.  The list of available server always returns zero.

 

I have similar code in place on the app to scan for UDP packets from the Plex Server, and this works on both an Android TV Emulator and real device.   Any idea, why server discovery doesn't work with the provided Java API on the emulator.

 

Also, it seems to take between a second or two before a device is discovered using the API when it does run on a device.

 

 

Link to comment
Share on other sites

I'm not sure why it doesn't work in an emulator, although i haven't tested that in a while so I don't recall exactly what my experience with it was.

 

The reason it takes a couple seconds is because it's not looking for a single server, rather it is given an amount of time to scan and then it reports back with all servers that responded to the broadcast. If you want a faster result what you could do is just shorten that time period.

Link to comment
Share on other sites

kingargyle

I'm not sure why it doesn't work in an emulator, although i haven't tested that in a while so I don't recall exactly what my experience with it was.

 

The reason it takes a couple seconds is because it's not looking for a single server, rather it is given an amount of time to scan and then it reports back with all servers that responded to the broadcast. If you want a faster result what you could do is just shorten that time period.

 

Thanks, I see the time out is set for a second which would explain why I don't get anything before then.  I'm probably going to need to write my own modified implementation of the existing code, so that it calls a call back for each server it finds instead of waiting a full second before returning the results.   The current implementation doesn't call on each response, so unfortunately doesn't fit my current needs.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...