Code example for DatagramSocket

Methods: getLocalAddressgetLocalPort

0
	public void start()	{ 
 
		StringBuffer name = new StringBuffer("Cyber.SSDPSearchResponseSocket/");
		DatagramSocket s = getDatagramSocket();
		// localAddr is null on Android m3-rc37a (01/30/08) 
		InetAddress localAddr = s.getLocalAddress();
		if (localAddr != null) {
			name.append(s.getLocalAddress()).append(':');
			name.append(s.getLocalPort());
		} 
		deviceSearchResponseThread = new Thread(this,name.toString());
		deviceSearchResponseThread.start();		
	} 
	 
	public void stop() 
	{ 
		deviceSearchResponseThread = null;
	} 
 
	//////////////////////////////////////////////// 
Connect your IDE to all the code out there  Get Codota for Java