Example usage for android.net.nsd NsdServiceInfo setPort

List of usage examples for android.net.nsd NsdServiceInfo setPort

Introduction

In this page you can find the example usage for android.net.nsd NsdServiceInfo setPort.

Prototype

public void setPort(int p) 

Source Link

Document

Set port number

Usage

From source file:org.drulabs.localdash.nsddiscovery.NsdHelper.java

public void registerService(int port) {
    tearDown(); // Cancel any previous registration request
    initializeRegistrationListener();/*w ww  .ja  va2  s .c  o m*/
    NsdServiceInfo serviceInfo = new NsdServiceInfo();
    serviceInfo.setPort(port);
    serviceInfo.setServiceName(mServiceName);
    serviceInfo.setServiceType(SERVICE_TYPE);
    Log.v(TAG, Build.MANUFACTURER + " registering service: " + port);
    mNsdManager.registerService(serviceInfo, NsdManager.PROTOCOL_DNS_SD, mRegistrationListener);
}

From source file:ibp.plugin.nsd.NSDHelper.java

public void registerService(String name, int port) {
    NsdServiceInfo serviceInfo = new NsdServiceInfo();
    serviceInfo.setPort(port);
    serviceInfo.setServiceName(name);//from   ww  w .  java  2 s. c  o  m
    serviceInfo.setServiceType(SERVICE_TYPE);
    mNsdManager.registerService(serviceInfo, NsdManager.PROTOCOL_DNS_SD, mRegistrationListener);
}