Code example for DatagramSocket

Methods: setBroadcast, setSoTimeout

0
			BPF.getInstance().getBPFLogger().error(TAG, "must specify port");
			return false; 
		} 
 
		try { 
			socket_ = new DatagramSocket(port_);
			socket_.setBroadcast(true);
			socket_.setSoTimeout(TIMEOUT_MS);
		} catch (IOException e) {
			BPF.getInstance().getBPFLogger() 
					.error(TAG, "bind failed " + e.getMessage());
		} 
 
		BPF.getInstance().getBPFLogger().debug(TAG, "starting thread");
 
		return true; 
 
	} 
 
	/** 
	 * Main loop in Discovery