0

I have a problem of getting the registered services port numbers. Actually my application registers a service with port xxxx (e.g 40206), and the registration is done successfully. On the other device, when I registered discovery to discover all of the registered services, I found the service successfully with a valid Host name, but wrong port number, it always returns port 41.

@Override
public void onServiceResolved(NsdServiceInfo serviceInfo) {
    Log.d(TAG, serviceInfo.getPort());
}

Any help why it happens and how to solve it?

Nika Kurdadze
  • 2,502
  • 4
  • 18
  • 28
Amjad Omari
  • 1,104
  • 3
  • 15
  • 40

1 Answers1

0

using the google NSD service sample code is using a default port "41" in the NSDHelper class, so you have to make sure the you are passing the correct port number to the registerService(Port) function.

Amjad Omari
  • 1,104
  • 3
  • 15
  • 40