Code example for NsdServiceInfo

Methods: getHost, getPort

0
 
            @Override 
            public void onServiceResolved(NsdServiceInfo serviceInfo) {
                Log.e(TAG, "Resolve Succeeded. " + serviceInfo);
 
                if (serviceInfo.getHost().equals(myIP)) {
                    Log.d(TAG, "Same IP.");
                    return; 
                } 
                mService = serviceInfo;
                portaConectada = serviceInfo.getPort();
                hostConectado = serviceInfo.getHost();
            } 
        }; 
    } 
 
    public void initializeRegistrationListener() { 
        registrationListener = new NsdManager.RegistrationListener() {
 
            @Override 
            public void onServiceRegistered(NsdServiceInfo nsdServiceInfo) {